简体   繁体   中英

nodejs Couldn't read dependencies when triggering “npm install”

I'm getting the below error.

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 command installs node packages wich are written in package.json file for example you have package.json :

{
    "name": "application-name"
  , "version": "0.0.1",
  "main": "app.js"
  , "dependencies": {
      "express": "*"
    , "jade": "*"
    ,"cookie-parser":"*"
  },
  "scripts": {
    "start": "node app.js"
  }
}

when you write npm install it will install dependencies express jade and cookie-parser you recieve this error because you have no package.json so if you want to install this packages without package.json you have to write: npm install express npm install jade npm install cookie-parser

It is certain from the type of error you get that you do not have a package.json file at the directory in which you type npm install . You should first use npm init which creates the necessary package.json file and then type npm install .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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