0

I'm trying to install Yeoman so I can install AngularJS, but I run into problems regarding the version of npm. Here's the output when I run npm install -g yo:

npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/home/marieficid/.node/bin/yo -> /home/marieficid/.node/lib/node_modules/yo/lib/cli.js

> yo@1.6.0 postinstall /home/marieficid/.node/lib/node_modules/yo
> yodoctor


Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✖ Node.js version

Your Node.js version is outdated.
Upgrade to the latest version: https://nodejs.org

✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✖ npm version

Your npm version is outdated.

Upgrade to the latest version by running:
npm install -g npm

✔ NODE_PATH matches the npm root

Found potential issues on your machine :(
/home/marieficid/.node/lib
└── yo@1.6.0 

And here's the output when I run npm install -g npm@latest (my current version is 3.7.3):

/home/marieficid/.node/bin/npm -> /home/marieficid/.node/lib/node_modules/npm/bin/npm-cli.js
/home/marieficid/.node/lib
└── npm@3.7.3 

Anyone knows how to fix this?

EDIT: running sudo npm --version returns 2.14.12 instead of 3.7.3.

1 Answers1

0

You most likely have a .npmrc file in your home folder that contains a prefix variable.

If this is the case you will have to update your $PATH variable adding the new bin path, in your case $HOME/.node/bin/, also ensure it is after which ever path npm is currently in, this you can find out by using which npm. To set your path variable: What is the PATH environment variable and how do I add to it? and https://help.ubuntu.com/community/EnvironmentVariables

Jkamzi
  • 1
  • Hey @JKamzi, I appreciate the help a lot, however I seem to have done something very wrong and when I try to run npm install -g n I get /usr/bin/env: node: File or directory not found, do you know how I can fix this? – napstablook Feb 25 '16 at 20:43
  • You have most likely messed up your $PATH variable. Can you run echo $PATH in your terminal and ensure everything is fine. it should look something like this export PATH=$PATH:/some/other/path:/another/path – Jkamzi Feb 25 '16 at 21:01
  • It's definitely messed up. Here's what I get: /home/marieficid/.node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin Do you know how to fix it? – napstablook Feb 25 '16 at 21:03
  • Your path looks fine. However on *buntu system it seem node is installed as nodejs. Symlnk seem to work ln -s /usr/bin/nodejs /usr/bin/node – Jkamzi Feb 25 '16 at 21:20
  • I hope you don't mind me asking for help again - I tried running this line ln -s /usr/bin/nodejs /usr/bin/node and I got an error: ln: failed to create link “/usr/bin/node”: File exists I tried the other way around and got the same error. Do you know what to do? – napstablook Feb 25 '16 at 23:00
  • I managed to get it working, thanks a lot for your help! – napstablook Feb 26 '16 at 11:55