- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Mac OS X 10.11.5 (El Capitan)
- Versions. Please run
ng --version
. If there’s nothing outputted, please run
in a Terminal: node --version
and paste the result here:
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: darwin x64
- Repro steps. Was this an app that wasn’t created using the CLI? What change did you
do on your code? etc.
clone from repository
npm install --save-dev angular-cli@webpack
ng version
- The log given by the failure. Normally this include a stack trace and some
more information.
Cannot find module 'package.json'
Error: Cannot find module 'package.json'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at AddonDiscovery.discoverAtPath (/Users/thomasknobloch/workspace/OXEWbm2/wbm/node_modules/angular-cli/lib/models/addon-discovery.js:205:20)
at AddonDiscovery.<anonymous> (/Users/thomasknobloch/workspace/OXEWbm2/wbm/node_modules/angular-cli/lib/models/addon-discovery.js:114:26)
at Array.map (native)
at AddonDiscovery.discoverFromDependencies (/Users/thomasknobloch/workspace/OXEWbm2/wbm/node_modules/angular-cli/lib/models/addon-discovery.js:109:68)
at AddonDiscovery.discoverProjectAddons (/Users/thomasknobloch/workspace/OXEWbm2/wbm/node_modules/angular-cli/lib/models/addon-discovery.js:48:29)
at Project.discoverAddons (/Users/thomasknobloch/workspace/OXEWbm2/wbm/node_modules/angular-cli/lib/models/project.js:353:40)
- Mention any other details that might be useful.
ng version
works fine outside of my project (using the global installation of angular-cli).
I like turtles
Just an FYI for anyone else dealing with this issue. I received a similar error message when I would run any angular cli commands (ng serve, ng version etc.) saying
Error: Cannot find module 'package.json
. I found out that the issue was caused by using a bad npm package (crypto), although I’m not entirely sure why that would have caused the error. When I removed that package from my package.json file, all the angular cli commands worked perfectly. I’m now using bcrypt instead.Try ‘Npm install --save http’ It will add “http” on version 0.0.0 This reliably reproduces the problem Tried 3 times, and that is the error.
I can send a video if you want.
I’m having this same problem on beta 18.
angular-cli: 1.0.0-beta.18 node: v6.9.1 npm: 3.10.8
After much reading and analysis, the crypto package cause ember-cli to panic. Just remove it npm uninstall crypto --save