The command “npm run build — --prod” exited with code 1 error

淺唱寂寞╮ 提交于 2019-11-30 11:03:43

Perform any of the following options as long as there is an error

  1. For passing an argument to build command:

    change 'npm run build -- --prod' to 'npm run build --prod' in the .csproj file

  2. Open ClientApp folder and Update project angular-cli with this CMD command:

    npm install --save-dev @angular/cli@latest

  3. Update visual studio NodeJS and npm from:

    Tools > Options > Projects and Solutions > Web Package Management > External Web Tools

If NodeJS and npm aren't installed on your environment path Add NodeJS and npm folder to the top of the list else move $(path) to the top of the list

.

Thank @Praveen Kumar and @Yerkon

Got same error, my environment:

.NET Core 2.1 RC-1
Angular v5.2.4
NPM v5.7.1
Node v8.11.2

And nothing mentioned above did not helped. Simple go to ".\ClientApp" //Angula-CLI project and run

npm run build

then you will see real errors - so that means simple you have some errors in code, so fix angular UI code and it will build fine :).

Maybe in command line NodeJS version of Visual Studio is old. In your command output we can see:

node@v6.10.3

Update NodeJS

Try running: ng build "prod" and see what the actual error is.

Check this maybe you have problem with lack of memory

 "build": "node --max-old-space-size=4069 node_modules/@angular/cli/bin/ng build --prod",
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!