Error running npm-install: Failed to install. Mistake! No version

Just got a new hard drive, installed GIT, Mongodb, node and npm, added GIT to PATH and tried to run npm install -g. Here is the complete 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 other people with this problem but couldn't 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?

+3


source to share


3 answers


As the error says, your package.json

field is missing version

. Add one and the error should be gone.



+3


source


yes it looks like it treats -g as a package, I don't know the exact reason why this worked for me



  • 1: if you have a cmd window open when admin close it and open normal cmd (not admin)
  • 2: your window is open before nodejs installation is complete, so close it and reopen it.
+5


source


You need the version in your package.json as mentioned here: https://www.npmjs.org/doc/files/package.json.html

The most important things in your package.json are the name and versions. These are really necessary and your package won't install without them. The name and version together form an identifier that is considered completely unique.

+1


source







All Articles