Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error not a package C:\Program Files\nodejs\npm

Tags:

npm

I am new to node and npm and have been tryng to update npm from version 1.4.3 o the latest one. The procedure I am following to do this is

navigate to C:\Program Files (x86)\nodejs with cmd.exe and then run the installation without -g: npm install npm (from npm github)

The problem is that when I run

npm install npm

I get

npm ERR! not a package C:\Program Files\nodejs\npm

npm ERR! addLocal Could not install C:\Program Files\nodejs\npm

npm ERR! Windows_NT 6.2.9200

npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "npm"

npm ERR! node v0.10.30

npm ERR! npm v2.2.0

npm ERR! path C:\Users\ADMINI~1.PLA\AppData\Local\Temp\3\npm-9796-44646cae\unpack-c30e5ffdacdb\package.json

npm ERR! code ENOENT

npm ERR! errno 34

npm ERR! enoent ENOENT, open 'C:\Users\ADMINI~1.PLA\AppData\Local\Temp\3\npm-9796-44646cae\unpack-c30e5ffdacdb\package.json'

npm ERR! enoent This is most likely not a problem with npm itself

npm ERR! enoent and is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! Please include the following file with any support request:

But after this when I run

npm --version

it shows me

N:\Program Files\nodejs>npm -v

2.2.0

but from some other folder it still shows me

N:\Program Files>npm -v

1.4.3

So, how can I fix this.

like image 465
mu_sa Avatar asked Jan 12 '15 15:01

mu_sa


1 Answers

I think the first error (not a package) is coming because npm is looking at the filesystem and sees the npm command before it looks at the npm registry. You can work around that by running npm install npm@latest

It looks like a couple of things are wrong. Here's what I would suggest:

  1. Upgrade to the latest node (0.10.35) http://nodejs.org/download/

  2. Follow the npm update instructions from here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows (though it looks like you are already doing this).

  3. Close and re-open your terminal (cmd.exe or bash) windows so that they definitely have the new PATH and the new npm.

If that doesn't work, please post your PATH environment variable - you can print this from cmd.exe by running echo %PATH% at the > prompt, or from a bash terminal by running echo $PATH. There may be more than one installation of npm in your path, which would mess things up.

like image 94
Sam Mikes Avatar answered Oct 01 '22 05:10

Sam Mikes