Angular-cli: ng build --prod failure

Created on 11 Aug 2017  Â·  10Comments  Â·  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.3.0
node: 8.2.1
os: win32 x64
@angular/animations: 4.3.3
@angular/common: 4.3.3
@angular/compiler: 4.3.3
@angular/core: 4.3.3
@angular/forms: 4.3.3
@angular/http: 4.3.3
@angular/platform-browser: 4.3.3
@angular/platform-browser-dynamic: 4.3.3
@angular/router: 4.3.3
@angular/cli: 1.3.0
@angular/compiler-cli: 4.3.3
@angular/language-service: 4.3.3

Repro steps.

  1. ng build --prod
  2. I will see the error message

The log given by the failure.

fs.js:652
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);

  Error: ENOENT: no such file or directory, open 'C:\software\test\node_modules\_@[email protected]@@angular\package.json'
    at Object.fs.openSync (fs.js:652:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at licensePlugin.readPackageJson (C:\software\test\node_modules\[email protected]@license-webpack-plugin\index.js:26:19)
    at licensePlugin.getModuleInfo (C:\software\test\node_modules\[email protected]@license-webpack-plugin\index.js:30:28)
    at licensePlugin.<anonymous> (C:\software\test\node_modules\[email protected]@license-webpack-plugin\index.js:81:31)
    at Array.filter (native)
    at licensePlugin.writeModuleInfo (C:\software\test\node_modules\[email protected]@license-webpack-plugin\index.js:77:8)
    at licensePlugin.gatherModuleInfo (C:\software\test\node_modules\[email protected]@license-webpack-plugin\index.js:117:10)
    at licensePlugin.<anonymous> (C:\software\test\node_modules\[email protected]@license-webpack-plugin\index.js:233:12)
    at Compiler.applyPlugins (C:\software\test\node_modules\[email protected]@tapable\lib\Tapable.js:61:14)
    at onCompiled (C:\software\test\node_modules\[email protected]@webpack\lib\Compiler.js:240:10)
    at applyPluginsAsync.err (C:\software\test\node_modules\[email protected]@webpack\lib\Compiler.js:520:14)
    at next (C:\software\test\node_modules\[email protected]@tapable\lib\Tapable.js:202:11)
    at Compiler.<anonymous> (C:\software\test\node_modules\[email protected]@webpack\lib\CachePlugin.js:62:5)
    at Compiler.applyPluginsAsyncSeries (C:\software\test\node_modules\[email protected]@tapable\lib\Tapable.js:206:13)
    at compilation.seal.err (C:\software\test\node_modules\[email protected]@webpack\lib\Compiler.js:517:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Desired functionality.

For the app to compile

Mention any other details that might be useful.

After I installed the following packages, there was a problem.
"@angular-redux/store": "^6.5.7",
"ng2-validation": "^4.2.0",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",

Most helpful comment

same issue

ng build --prod --no-extract-license works fine #7203

All 10 comments

The directory seems strange. It should be node_modules/@angular instead of node_modules_. This should be unrelated to @angular/cli.

@hieuxlu It was escaped. I have updated the error message.

I got same issue, both on Ubuntu and Mac

return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/path/node_modules/_@[email protected]@@angular/package.json'
    at Object.fs.openSync (fs.js:583:18)
    at Object.fs.readFileSync (fs.js:490:33)

Build without --prod works fine

UPDATE
Mine issue seems to related to cnpm, after deleting node_modules/ folder and use npm install instead, build with --prod works fine again.

same issue

ng build --prod --no-extract-license works fine #7203

@iygnay Thank you.

why angular-cli doesn‘’t support cnpm?

Mine issue seems to related to cnpm, after deleting node_modules/ folder and use npm install instead, build with --prod works fine again. @waterscar thank you

problem with cnpm also.

according to the stacktrace it seems related with "license-webpack-plugin",
since there's no package.json file in dir 'node_modules_@[email protected]@@angular' (which holds serveral sub-dirs).
@iygnay thx for the --no-extract-license parameter, and it should be getting rid of the "license-webpack-plugin".

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hareeshav picture hareeshav  Â·  3Comments

5amfung picture 5amfung  Â·  3Comments

NCC1701M picture NCC1701M  Â·  3Comments

brtnshrdr picture brtnshrdr  Â·  3Comments

gotschmarcel picture gotschmarcel  Â·  3Comments