简体   繁体   English

errno -2 的 npm 安装错误

[英]npm install errors for errno -2

I am trying to install npm,but it shows errors below:我正在尝试安装 npm,但它显示以下错误:

   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. Npm 将在当前目录中查找名为package.json的文件。 This file contain various information on a project including dependencies.此文件包含有关项目的各种信息,包括依赖项。
You need to create ( npm init ) or import that file from an existing project.您需要创建 ( npm init ) 或从现有项目导入该文件。

You can also specify a package to install manually by giving its name to npm:您还可以通过将其名称赋予 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.确保您位于package.json文件所在的项目目录/project-root-folder 中,然后您运行的任何npm命令都将起作用。 The problem was npm could not find your package.json as the directory path is wrong.问题是npm找不到您的package.json因为目录路径错误。

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

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