简体   繁体   中英

npm install errors for errno -2

I am trying to install npm,but it shows errors below:

   npm ERR! install Couldn't read dependencies
   npm ERR! Darwin 14.5.0
   npm ERR! argv  "/Users/bunniehsieh/.nvm/versions/node/v4.1.0/bin/node" "/Users/bunniehsieh/.nvm/versions/node/v4.1.0/bin/npm" "install"
   npm ERR! node v4.1.0
   npm ERR! npm  v2.14.3
   npm ERR! path /Users/bunniehsieh/package.json
   npm ERR! code ENOPACKAGEJSON
   npm ERR! errno -2
   npm ERR! syscall open

   npm ERR! package.json ENOENT: no such file or directory, open    '/Users/bunniehsieh/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! Please include the following file with any support request:
  npm ERR!     /Users/bunniehsieh/npm-debug.log

and I have tried to uninstall then install again,but it didn't work,please give me some advice or any help,THANKS!!!!!!

You have nothing to install.

Npm will look for a file named package.json in the current directory. This file contain various information on a project including dependencies.
You need to create ( npm init ) or import that file from an existing project.

You can also specify a package to install manually by giving its name to npm:

npm install package_name

Please have a full read of the official documentation

Ensure you are in your project directory/ project-root-folder where your package.json file exists then whatever npm commands you run will work. The problem was npm could not find your package.json as the directory path is wrong.

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