Issue getting npm install -g ember-cli to work - Node issue?

Hey guys,

I hope this isn’t too basic or silly of a question to ask - really looking forward to working with Ember Cli and not sure what’s going on. Im a bit new to node and think there’s something up with my NPM - any ideas? Thanks!

$npm install -g ember-cli
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "ember-cli"
npm ERR! node v0.10.35  
npm ERR! npm  v2.8.0
npm ERR! path /usr/local/lib/node_modules/ember-cli/.editorconfig    
npm ERR! code EACCES
npm ERR! errno 3

npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/ember-                       cli/.editorconfig'
npm ERR!  { [Error: EACCES, unlink '/usr/local/lib/node_modules/ember-cli/.editorconfig']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/ember-cli/.editorconfig' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink     '/usr/local/lib/node_modules/ember-cli/.editorconfig'
npm ERR! error rolling back  { [Error: EACCES, unlink     '/usr/local/lib/node_modules/ember-cli/.editorconfig']
npm ERR! error rolling back   errno: 3,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/ember-cli/.editorconfig' }

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/apprentice/Desktop/npm-debug.log

What platform are you running on? Windows, MacOS, Linux? I most cases the -g option (for global) requires to run the command with admin rights. So for Linux/MacOS you should run something like sudo npm install -g ember-cli. For Windows, make sure your terminal has admin rights too (should be the case by default).

1 Like

It looks as though there there is a likely a permissions issue and that the node environment environment you have configured is only working with sudo access.

For a lot of subtle reasons you really want to avoid having to use sudo when installing node and node modules.

In general, I would recommend removing node completely from your computer (there are various instructions on how to do this if you google around) and then reinstall node and npm cleanly using only local user permissions. It will make things less complicated and less error prone in the long run.

Once you have removed node…

NVM (Node Version Manager) is a clean way to manage and install node on your Mac and you can easily install multiple versions if needed.

See more here.

The trick is to never use sudo when running node and npm commands, that way you can be assured everything will just work with your regular user permissions and everything will be installed in your regular home directory.

The reason I suggest uninstalling node first is that you will want to avoid conflicts with multiple versions of node in your $PATH and make sure you are always using the version installed with regular user permissions.

I wrote a general write up here if you are new to node and ember cli Introduction to Ember CLI, Node and NPM · GitHub

Hope it helps

@guigouz He is on Mac OS X because it says

Darwin 14.1.0

Which is the open source port of BSD that OS X is based on.

Thanks guys! I’ll remove node and reinstall everything - see how that works.

1 Like

Hey guys - I seem to still be running into some issues getting ember-cli to work. I followed the steps to uninstall node and npm and reinstall. It

$ ember 
 bash: ember: command not found

Here’s what I’m getting when I try to install ember

$ npm install -g ember-cli

Here’s what I’m getting

ws@0.5.0 install /Users/apprentice/.node/lib/node_modules/ember-cli/node_modules/testem/node_modules/socket.io/node_modules/engine.io/node_modules/ws (node-gyp rebuild 2> builderror.log) || (exit 0)

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o SOLINK_MODULE(target) Release/bufferutil.node SOLINK_MODULE(target) Release/bufferutil.node: Finished CXX(target) Release/obj.target/validation/src/validation.o SOLINK_MODULE(target) Release/validation.node SOLINK_MODULE(target) Release/validation.node: Finished

ws@0.4.31 install /Users/apprentice/.node/lib/node_modules/ember-cli/node_modules/testem/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws (node-gyp rebuild 2> builderror.log) || (exit 0)

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o /Users/apprentice/.node/bin/ember → /Users/apprentice/.node/lib/node_modules/ember-cli/bin/ember ember-cli@0.2.3 /Users/apprentice/.node/lib/node_modules/ember-cli ├── broccoli-unwatched-tree@0.1.1 ├── pleasant-progress@1.0.2 ├── is-git-url@0.2.0 ├── abbrev@1.0.5 ├── ember-cli-copy-dereference@1.0.0 ├── broccoli-writer@0.1.1 ├── promise-map-series@0.2.1 ├── js-string-escape@1.0.0 ├── walk-sync@0.1.3 ├── broccoli-merge-trees@0.2.1 ├── exit@0.1.2 ├── temp@0.8.1 (rimraf@2.2.8) ├── semver@4.3.3 ├── strip-ansi@2.0.1 (ansi-regex@1.1.1) ├── rsvp@3.0.18 ├── debug@2.1.3 (ms@0.7.0) ├── broccoli-sane-watcher@1.0.2 (broccoli-slow-trees@1.1.0) ├── broccoli-filter@0.1.12 (mkdirp@0.3.5) ├── symlink-or-copy@1.0.1 (copy-dereference@1.0.0) ├── http-proxy@1.10.1 (requires-port@0.0.0, eventemitter3@0.1.6) ├── rimraf@2.3.2 (glob@4.5.3) ├── broccoli-funnel@0.2.2 (mkdirp@0.5.0) ├── broccoli-kitchen-sink-helpers@0.2.6 (mkdirp@0.3.5, glob@4.0.4) ├── sane@1.0.3 (watch@0.10.0, fb-watchman@0.0.0, minimatch@0.2.14, walker@1.0.6) ├── markdown-it@4.0.3 (linkify-it@1.0.0, uc.micro@1.0.0, mdurl@1.0.0, entities@1.1.1, argparse@1.0.2) ├── yam@0.0.18 (lodash.merge@3.1.0) ├── ember-router-generator@0.3.3 (recast@0.9.18) ├── broccoli-es3-safe-recast@2.0.0 (es3-safe-recast@2.0.1) ├── broccoli-es6modules@0.5.1 (broccoli-caching-writer@0.5.3, mkdirp@0.5.0, esperanto@0.6.28) ├── core-object@0.0.2 (lodash-node@2.4.1) ├── broccoli-caching-writer@0.5.5 (core-object@0.0.3, lodash-node@2.4.1) ├── broccoli-sourcemap-concat@0.4.3 (broccoli-caching-writer@0.5.3, mkdirp@0.5.0, combined-stream@0.0.7, fast-sourcemap-concat@0.2.4, lodash-node@2.4.1) ├── markdown-it-terminal@0.0.2 (ansi-styles@2.0.1, cli-table@0.3.1, cardinal@0.5.0, lodash-node@3.6.0) └── testem@0.8.0-0 (growl@1.8.1, styled_string@0.0.1, did_it_work@0.0.6, consolidate@0.11.0, charm@1.0.0, xmldom@0.1.19, async@0.9.0, mustache@1.2.0, cross-spawn@0.2.9, commander@2.8.0, glob@4.5.3, colors@1.0.3, mkdirp@0.5.0, backbone@1.1.2, fileset@0.1.5, fireworm@0.6.6, npmlog@1.2.0, js-yaml@3.2.7, tap@0.6.0, socket.io@1.3.5)

Did you reinstall with nvm?

what is returned when you type?

node --version 

what is returned when you type?

npm -version

what is returned when you type?

which ember

what is returned when you type?

which node

Thanks for the help - here’s what I get.

node --version => v0.12.2

npm -version => 2.7.4

which ember => (I get nothing)

which node => /usr/local/bin/node

nvm => Node Version Manager

It appears that perhaps nvm and node weren’t installed correctly.

remove the node in

/usr/local/bin/node

And then follow the NVM install instructions here: https://github.com/creationix/nvm/blob/master/README.markdown

e.g.

curl https://raw.githubusercontent.com/creationix/nvm/v0.24.1/install.sh | bash

If that command runs successfully you should have NVM installed and then you can use NVM to download and install node itself. Here is the NVM command to install a specific version of node:

nvm install 0.12

Once that is done when you run the command

which node

If should return something like this (depending on which version of node gets installed).

/Users/apprentice/.nvm/versions/node/v0.12.2/bin/node