【问题标题】:npm install errors for errno -2errno -2 的 npm 安装错误
【发布时间】:2015-09-21 08:45:45
【问题描述】:

我正在尝试安装 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

我已经尝试卸载然后重新安装,但它没有成功,请给我一些建议或帮助,谢谢!!!!!!

【问题讨论】:

    标签: node.js reactjs npm errno


    【解决方案1】:

    您无需安装任何东西。

    Npm 将在当前目录中查找名为 package.json 的文件。此文件包含有关项目的各种信息,包括依赖项。
    您需要创建 (npm init) 或从现有项目中导入该文件。

    您还可以通过将包的名称指定给 npm 来指定要手动安装的包:

    npm install package_name
    

    请完整阅读official documentation

    【讨论】:

      【解决方案2】:

      确保您位于您的项目目录/项目根文件夹中,您的package.json 文件存在于其中,然后您运行的任何npm 命令都将起作用。问题是npm 找不到您的package.json,因为目录路径错误。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-08-01
        • 2016-08-12
        • 2019-03-08
        • 1970-01-01
        • 2022-11-20
        • 1970-01-01
        • 2016-03-17
        • 2023-03-30
        相关资源
        最近更新 更多