[英]nodejs Couldn't read dependencies when triggering “npm install”
我收到以下错误。
D:\Ashley\nodejs>npm install
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open 'D:\Ashley\nodejs\package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "D:\\Ashley\\nodejs\\\\node.exe" "D:\\Ashley\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd D:\Ashley\nodejs
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path D:\Ashley\nodejs\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\Ashley\nodejs\npm-debug.log
npm ERR! not ok code 0
npm install命令安装用package.json文件编写的节点程序包,例如,您具有package.json:
{
"name": "application-name"
, "version": "0.0.1",
"main": "app.js"
, "dependencies": {
"express": "*"
, "jade": "*"
,"cookie-parser":"*"
},
"scripts": {
"start": "node app.js"
}
}
当您编写npm install时,它将安装依赖项express jade和cookie-parser,您将收到此错误,因为您没有package.json,因此,如果要安装不带package.json的软件包,则必须编写:npm install express npm install jade npm安装cookie解析器
从得到的错误类型可以肯定,您在键入npm install
的目录中没有package.json文件。 您应该首先使用npm init
来创建必要的package.json文件,然后键入npm install
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.