【问题标题】:npm install -g cordova and ionic 2 errornpm install -g cordova 和 ionic 2 错误
【发布时间】:2016-09-19 12:13:30
【问题描述】:

我尝试安装 ionic 2 几个小时,但没有成功。 当我使用命令“npm install -g cordova”通过cmd安装cordova时 我收到此错误

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Adir\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "cordova"
npm ERR! node v4.5.0
npm ERR! npm  v3.10.7
npm ERR! path C:\Users\Adir\AppData\Roaming\npm\node_modules\.staging\abbrev-ed18b12b
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Adir\AppData\Roaming\npm\node_modules\.staging\abbrev-ed18b12b' -> 'C:\Users\Adir\AppData\Roaming\npm\node_modules\cordova\node_modules\npm\node_modules\abbrev'
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Adir\AppData\Roaming\npm\node_modules\.staging\abbrev-ed18b12b' -> 'C:\Users\Adir\AppData\Roaming\npm\node_modules\cordova\node_modules\npm\node_modules\abbrev'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Adir\npm-debug.log
npm ERR! code 1

当我通过这个命令“npm install -g ionic”安装 ionic 时 我收到此错误

npm WARN In ionic@2.0.0 replacing bundled version of semver with semver@4.2.0

npm WARN 在 ionic@2.0.0 中,将 ionic-app-lib 的捆绑版本替换为 ionic-app-lib@2.0.0 npm 错误! Windows_NT 10.0.14393 npm 错误! argv "C:\Program Files\nodejs\node.exe" "C:\Users\Adir\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "安装" "-g" "ionic" npm 错误!节点 v4.5.0 npm 错误! npm v3.10.7 npm 错误!路径 C:\Users\Adir\AppData\Roaming\npm\node_modules.staging\ansi-75d35ef1 npm 错误!代码ENOENT npm 错误!错误号 -4058 npm 错误!系统调用重命名

npm 错误! enoent ENOENT:没有这样的文件或目录,重命名 'C:\Users\Adir\AppData\Roaming\npm\node_modules.staging\ansi-75d35ef1' -> 'C:\Users\Adir\AppData\Roaming\npm\node_modules\ ionic\node_modules\cordova-lib\node_modules\ansi' npm 错误! enoent ENOENT:没有这样的文件或目录,重命名 'C:\Users\Adir\AppData\Roaming\npm\node_modules.staging\ansi-75d35ef1' -> 'C:\Users\Adir\AppData\Roaming\npm\node_modules\ ionic\node_modules\cordova-lib\node_modules\ansi' npm 错误! enoent 这很可能不是 npm 本身的问题 npm 错误! enoent 并且与 npm 无法找到文件有关。 npm 错误!恩恩特

npm 错误!请在任何支持请求中包含以下文件: npm 错误! C:\Users\Adir\npm-debug.log npm 错误!代码 1

【问题讨论】:

    标签: cordova npm installation ionic2


    【解决方案1】:

    解决我的问题的是我尝试在 mac 中通过 brew 卸载并重新安装节点
    npm cache clean
    brew uninstall --force node
    rm -r /usr/local/lib/node_modules
    brew install node

    现在如果你运行“哪个节点”
    应该是/usr/local/bin/node

    现在在我的 .bash_profile 中将 NODE_PATH 设置为
    export NODE_PATH=/usr/local/lib/node_modules

    在这之后它给了我任何问题

    【讨论】:

      【解决方案2】:

      好像你有一些版本不匹配的问题。所以下载最新的节点,安装最新的 npm 并重新开始。

      npm install npm@latest -g
      npm cache clean
      npm uninstall -g cordova
      npm intsall -g cordova
      

      【讨论】:

      • 卸载和安装的拼写错误
      • 仍然帮我解决我的问题
      【解决方案3】:

      校验和失败 npm ERR! shasum 检查失败

      您可以尝试升级到最新版本的 npm :

      npm install -g npm 
      

      升级到 npm 3。

      还有:

      npm cache clean
      

      enter code here
      

      npm 设置注册表https://registry.npmjs.org/

      【讨论】:

        【解决方案4】:
        1 - Install the latest version of NodeJS from their website (e.g. 6.X.X).
        2 - Open the Node.js command prompt as administrator.
        3 - Run: npm cache clean
        4 - Run: npm uninstall -g ionic
        5 - Run: npm uninstall -g cordova
        6 - Run: npm install -g ionic
        7 - Run: npm install -g cordova
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2018-10-29
          • 2017-02-18
          • 1970-01-01
          • 2015-08-05
          • 1970-01-01
          • 2020-05-23
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多