我写了一个Maven应用程序(在Docker容器中运行),它编译Angular应用程序。在pom.xml中,我有接近尾声的部分:
[...]
<execution>
<id>npm run build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build:hello</argument>
</arguments>
</configuration>
</execution>
[...]在package.json中,我有
"build:hello": "ng build hello --base-href /hello --deploy-url /hello/static/ --prod && cd ./projects/hello-app && gulp tasks --base-href=/hello --deploy-url=/hello/static/",在本地环境中,它可以正常工作
On Docker失败,并显示以下错误
The build command requires to be run in an Angular project, but a project definition could not be found.当前工作目录为/
在/文件夹中,我有:
[...]
pom.xml
package.json
package-lock.json
node_modules
angular.json
/projects/hello-app
[...]前面的所有npm命令都有效(npm ci、npm install、..)
有什么建议吗?
发布于 2021-08-31 19:40:10
我找到问题了。太疯狂了。出于某种未知的原因,文件夹/(根目录)不起作用,我复制了/app下的所有内容,并从那里运行npm build,它起作用了!
在我看来,这毫无意义
https://stackoverflow.com/questions/69002286
复制相似问题