简体   繁体   English

无法使用我的package.json安装依赖包

[英]Unable to install a dependencies package using my package.json

I have a package.json but when I try to run it in my command console I got this error: 我有一个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

Here's my package.json 这是我的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"
    }
}

Can you help me with this? 你能帮我吗? It says that I have an error in the version part. 它说我的版本部分有错误。

The answer is in the error message: 答案在错误消息中:

npm ERR! npm ERR! Invalid version: "0.1" 无效版本:“ 0.1”

In your package.json , you have this: package.json ,具有以下内容:

"version": "0.1",` “ version”:“ 0.1”,`

You need to format this to meet the semver requirements (see the npm package.json docs and the node-semver repo ). 您需要格式化它以满足semver的要求(请参阅npm package.json文档node-semver repo )。 Add a 0 in front ( 0.0.1 ) and your error should vanish. 在前面添加一个00.0.1 ),错误将消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM