Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running npm-install: Could not install . Error! No version provided

Just got a new hard drive, installed GIT, Mongodb, node and npm, added GIT to the PATH, and tried to run npm install -g. Here's the full error message:

npm ERR! addLocal Could not install .
npm ERR! Error: No version provided
npm ERR!     at needVersion (C:\Program Files\nodejs\node_modules\npm\lib\cache
add-local.js:144:40)
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\lib\cache\add-local.js
77:10
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-pack
ge-json\read-json.js:51:40
npm ERR!     at final (C:\Program Files\nodejs\node_modules\npm\node_modules\re
d-package-json\read-json.js:349:17)
npm ERR!     at then (C:\Program Files\nodejs\node_modules\npm\node_modules\rea
-package-json\read-json.js:126:33)
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-pack
ge-json\read-json.js:316:48
npm ERR!     at evalmachine.<anonymous>:207:20
npm ERR!     at OpenReq.Req.done (C:\Program Files\nodejs\node_modules\npm\node
modules\graceful-fs\graceful-fs.js:141:5)
npm ERR!     at OpenReq.done (C:\Program Files\nodejs\node_modules\npm\node_mod
les\graceful-fs\graceful-fs.js:61:22)
npm ERR!     at Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\no
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g"
npm ERR! cwd C:\Users\username\NSFCyberHealth\server
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\username\NSFCyberHealth\server\npm-debug.log
npm ERR! not ok code 0

I've searched for other people with this issue, but haven't been able to find any fixes. here is my package.json file:

{
  "name": "node-authentication",
  "main": "server.js",
  "dependencies" : {
    "express" : "~3.4.4",
    "ejs" : "~0.8.5",
    "mongoose" : "~3.8.1",
    "passport" : "~0.1.17",
    "passport-local" : "~0.1.6",
    "passport-facebook" : "~1.0.2",
    "passport-twitter" : "~1.0.2",
    "passport-google-oauth" : "~0.1.5",
    "connect-flash" : "~0.1.1",
    "bcrypt-nodejs" : "latest",
    "socket.io" : "0.9.x",
    "JSV" : "4.0.x"
  }
}

Does anyone know what is causing this error?

like image 643
Ryan McGarvey Avatar asked May 09 '26 04:05

Ryan McGarvey


2 Answers

yes, it's looks it's treat the -g as package i don't know the exact reason why but these worked for me

  • 1: if you opened the cmd window as administrator close it and open the usual cmd(not admin)
  • 2: your window is opened before finishing nodejs setup so close it and reopen it.
like image 65
Abdul Hameed Avatar answered May 12 '26 10:05

Abdul Hameed


As the error says, your package.json is missing a version field. Add one and the error should go away.

like image 31
mscdex Avatar answered May 12 '26 11:05

mscdex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!