我有一个package.json但是当我尝试在命令控制台中运行它时出现了这个错误:
$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 5.1.2600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! Invalid version: "0.1"
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! F:\UwAmp\www\nodejs\express\npm-debug.log
这是我的package.json
{
"name": "Express101",
"version": "0.1",
"description": "This is a practice demo for express node",
"main": "app.js",
"author": {
"name": "Juan Dela Cruz",
"email": "jdcruz01@gmail.com"
},
"dependencies": {
"express": "^4.13.3",
"jade": "^1.11.0"
}
}
你能帮我解决这个问题吗?它说我的版本部分有错误。
答案 0 :(得分:2)
答案在错误消息中:
npm ERR!版本无效:&#34; 0.1&#34;
在package.json
中,你有这个:
&#34;版本&#34;:&#34; 0.1&#34;,`
您需要对其进行格式化以满足semver要求(请参阅npm package.json docs和node-semver repo)。在前面添加0
(0.0.1
),你的错误应该消失。