[英]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. 刚刚得到一个新硬盘,安装了GIT,Mongodb,node和npm,将GIT添加到PATH,并尝试运行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:
这是我的package.json文件:
{
"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? 有谁知道导致此错误的原因是什么?
yes, it's looks it's treat the -g as package i don't know the exact reason why but these worked for me 是的,它看起来它是-g作为包我不知道确切的原因,但这些对我有用
As the error says, your package.json
is missing a version
field. 如错误所示,您的
package.json
缺少version
字段。 Add one and the error should go away. 添加一个,错误应该消失。
You need a version in your package.json, as indicated here: https://www.npmjs.org/doc/files/package.json.html 你需要在package.json中有一个版本,如下所示: https : //www.npmjs.org/doc/files/package.json.html
The most important things in your package.json are the name and version fields.
package.json中最重要的事情是名称和版本字段。 Those are actually required, and your package won't install without them.
这些实际上是必需的,如果没有它们,您的包将无法安装。 The name and version together form an identifier that is assumed to be completely unique.
名称和版本一起形成一个假定完全唯一的标识符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.