Angular-cli: angular 2 Cli not working in mac

Created on 2 Oct 2016  路  4Comments  路  Source: angular/angular-cli

Mac OSX (Yosemite 10.10.5)

The log given by the failure.

Binary is fine; exiting.
/usr/local/bin/ng -> /usr/local/lib/node_modules/angular-cli/bin/ng
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "angular-cli"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants webpack@*
npm ERR! peerinvalid Peer [email protected] wants webpack@^1.1.0 || ^2 || ^2.1.0-beta
npm ERR! peerinvalid Peer [email protected] wants webpack@^1.12.6 || ^2.1.0-beta
npm ERR! peerinvalid Peer [email protected] wants webpack@1 || 2 || ^2.0.0-beta || ^2.1.0-beta
npm ERR! peerinvalid Peer [email protected] wants webpack@^2.1.0-beta
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Nasz/GitHub/private/myangular2/npm-debug.log

Mention any other details that might be useful.

Versions. ng --version

Nasirs-MacBook-Pro:myangular2 Nasz$ ng --version
Cannot find module 'reflect-metadata'
Error: Cannot find module 'reflect-metadata'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/angular-cli/node_modules/@ngtools/webpack/src/index.js:5:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/angular-cli/models/webpack-build-typescript.js:5:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/angular-cli/models/webpack-config.js:2:34)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/angular-cli/tasks/build-webpack.js:6:24)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/angular-cli/commands/build.js:3:23)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Class.module.exports.includedCommands (/usr/local/lib/node_modules/angular-cli/addon/index.js:20:16)
at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:392:61
at Array.forEach (native)
at Project.addonCommands (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:391:15)
at Project.eachAddonCommand (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:426:30)
at module.exports (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/cli/lookup-command.js:33:13)
at CLI. (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/cli/cli.js:34:26)
at tryCatch (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:538:12)
at invokeCallback (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:553:13)
at publish (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:521:7)
at flush (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:2370:5)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)

Nasir.

All 4 comments

@nasihere -- the GitHub issue tracker is for project bugs and project feature requests as noted in CONTRIBUTING.md. For better support, consider creating a question on StackOverflow with all the details.

http://stackoverflow.com/questions/39812448/angular-cli-installation-failure

Thanks @JanStureNielsen.

Error fixed through below commands.
-npm install -g angular@latest
-npm install -g is-my-json-valid

This was a pain to figure out, so here is my solution

  1. npm install -g angular@latest

  2. Make sure the ng path is correct

    • cd ~/npm-global/bin
    • ls and make sure ng exists
  3. create .bashrc file on your home directory

    • touch ~/.bashrc
    • vim ~/.bashrc
  4. Add ng as alias

    • press a (enables edit mode) then type in the following
    • alias ng="~/npm-global/bin/ng"
    • press esc (to get out of edit mode) then :wq (in vim will save)
  5. Temporarily Update .bashrc reference
    Your terminal wont take bash updates until a restart but the following command will let you use the updates during the terminal session:

    • source ~/.bashrc
  6. Check that ng works

    • ng --version

Hope that helps someone!

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

naveedahmed1 picture naveedahmed1  路  3Comments

delasteve picture delasteve  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

NCC1701M picture NCC1701M  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments