【问题标题】:npm install ERR! code ENOENTnpm 安装错误!代码ENOENT
【发布时间】:2016-08-23 09:37:28
【问题描述】:

我是 nodejs 控制台的 npm install -g ionic 编写代码,我该如何解决这个错误。我是这个问题的一个星期,每个解决方案都尝试。 nodejs -v 6.4 npm 3.10.6 科尔多瓦 6.3 1)问题离子版本

    C:\Users\jhon>ionic --version
    Caught exception:
     Error: Cannot find module 'lodash/assign'
        at Function.Module._resolveFilename (module.js:455:15)
        at Function.Module._load (module.js:403:25)
        at Module.require (module.js:483:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (C:\Users\jhon\AppData\Roaming\npm\node_modules\ionic\node_modules\xmlbuilder\lib\index.js:5:12)
        at Object.<anonymous> (C:\Users\jhon\AppData\Roaming\npm\node_modules\ionic\node_modules\xmlbuilder\lib\index.js:14:4)
        at Module._compile (module.js:556:32)
        at Object.Module._extensions..js (module.js:565:10)
        at Module.load (module.js:473:32)
        at tryModuleLoad (module.js:432:12)

Mind letting us know? https://github.com/driftyco/ionic-cli/issues

2) 问题 npm install -g ionic **

C:\Users\jhon>npm install -g ionic
npm WARN deprecated cross-spawn-async@2.1.9: cross-spawn no longer requires a build toolchain, use it instead!
npm WARN deprecated lodash@2.1.0: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
C:\Users\jhon\AppData\Roaming\npm
`-- (empty)
npm WARN In ionic@2.0.0 replacing bundled version of semver with semver@4.2.0
npm WARN In ionic@2.0.0 replacing bundled version of ionic-app-lib with ionic-app-lib@2.0.0
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jhon\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ionic"
npm ERR! node v6.4.0
npm ERR! npm  v3.10.6
npm ERR! path C:\Users\jhon\AppData\Roaming\npm\node_modules\.staging\ansi-6308e9d7
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\jhon\AppData\Roaming\npm\node_modules\.staging\ansi-6308e9d7' -> 'C:\Users\jhon\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi'
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\jhon\AppData\Roaming\npm\node_modules\.staging\ansi-6308e9d7' -> 'C:\Users\jhon\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi'
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\jhon\npm-debug.log
npm ERR! code 1

**

【问题讨论】:

  • 你在代理后面运行
  • 谢谢 我怎样才能停止代理?
  • 你试过了吗?它是否有效或您遇到了什么错误

标签: node.js cordova ionic-framework npm


【解决方案1】:

在代理后面运行时安装 ionic

如果遇到很多错误,请卸载 Node.js。(可选)

安装 Nodejs(强制)

安装 Python(强制)

在安装过程中确保检查 python 的环境变量

第 1 步: start->cmd->(右键)以管理员身份运行

第 2 步: 键入以下命令 **cd** 以作为 root 用户工作

第 3 步: 如下设置 Windows 代理(使用您的组织代理)

set http_proxy=http://proxy.organisation.com:8000
set https_proxy=https://proxy.organisation.com:8000

第 4 步: 如下设置 npm 代理(使用您的组织代理)

npm config set proxy http://proxy.organisation.com:8000
npm config set https-proxy http://proxy.organisation.com:8000

第 5 步: 不要导航到用户文件夹(从根文件夹)执行以下命令

npm install -g cordova ionic

这将安装 ionic 和 cordova。

可能的错误:

  • 未找到 Python。
  • Windows_NT -> 原因是您不是管理员。
  • ECONNREFUSED -> 您的连接未通过代理检查在 npm 中使用 npm config list 命令。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-02
    • 2017-05-24
    • 1970-01-01
    • 2019-08-20
    • 2015-03-09
    • 2015-03-28
    • 2016-05-03
    • 2018-09-03
    相关资源
    最近更新 更多