Please provide us with the following information:
macOS Sierra
angular-cli: 1.0.0-beta.20-4
node: 7.1.0
os: darwin x64
install angular-cli as local dependency and call
$(npm bin)/ng --version
or any other parameter. Or alternatively call directly
./node_modules/.bin/ng --version
it always gives:
module.js:474
throw err;
^
Error: Cannot find module '../package.json'
at Function.Module._resolveFilename (module.js:472:15)
at Function.Module._load (module.js:420:25)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object.<anonymous> ([...]/node_modules/.bin/ng:8:21)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
which cannot work, obviously, since there is no package.json.
The workaround is to call ng directly via
./node_modules/angular-cli/bin/ng --version
which works.
I think is fixed now. We recently fiddled around with that logic and I can't repro on the latest version.
Hi,
When i run the npm install -g angular-cli command the its giving me error
module.js:472
throw err;
^
Error: Cannot find module 'C:\Users\zakir_jarman\AppData\Roaming\npm\node_modules\angular-cli\bin\ng
'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
Thanks in Advance.
Zakir Hussain
@zakir-hussain that should be npm install -g @angular/cli, so you'll probably want to do:
npm uninstall -g @angular/cli angular/cli
npm cache clean
npm install -g @angular/cli
If that doesn't fix it, you'll probably want to create a new issue, ensuring to fill out the template provided with reproduction steps.
Uninstall node
Delete folder Angular folder from Appdata>>Roaming>>...
As of npm@5, there should be used npm cache verify instead of npm cache clean.
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._
Most helpful comment
@zakir-hussain that should be
npm install -g @angular/cli, so you'll probably want to do:npm uninstall -g @angular/cli angular/clinpm cache cleannpm install -g @angular/cliIf that doesn't fix it, you'll probably want to create a new issue, ensuring to fill out the template provided with reproduction steps.