简体   繁体   English

node npm install -g 找不到模块配置链

[英]node npm install -g cannot find module config-chain

I configured the node plugins on jenkins to install grunt and bower globally.我在 jenkins 上配置了节点插件来全局安装 grunt 和 bower。

When i use it on a project npm install is executed:当我在项目中使用它时,执行 npm install:

 npm install -g bower@~1.2.8 grunt-cli@~0.1.11

Unfortunally it breaks immediately returning the following error:不幸的是,它立即中断并返回以下错误:

module.js:333
    throw err;
          ^
Error: Cannot find module 'config-chain'
    at Function.Module._resolveFilename (module.js:331:15)
    at Function.Module._load (module.js:273:25)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/Users/Shared/Jenkins/Home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_0.11.10/lib/node_modules/npm/node_modules/npmconf/npmconf.js:2:10)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)

I dont think config-chain is an extra plugin necessary to be installed for it to be there.我不认为 config-chain 是一个额外的插件,需要安装它才能存在。

Any ideas how to fix this?任何想法如何解决这一问题?

Edit.: Fixed it thanks to the accepted answer:编辑。:由于接受的答案修复了它:

npm auto-install isnt supported for mac at this time.目前 mac 不支持 npm 自动安装。 I had to download the package manually.我不得不手动下载软件包。

config-chain is npm dependency, so chances are that your npm installation is broken. config-chain是 npm 依赖项,因此您的 npm 安装可能已损坏。

Try to reinstall it, or use one of npm forks if npm itself isn't installable on your system for some reason.如果 npm 本身由于某种原因无法安装在您的系统上,请尝试重新安装它,或者使用 npm 分支之一。

Follow this suggest, i resolve it.按照这个建议,我解决了。 "Who ever faces this problem, please do a clean install of ionic" “谁遇到过这个问题,请重新安装 ionic”

npm install -g ionic npm install -g 离子

If it got installed and you're still facing issues, easily install each missing module you face, globally example如果它已安装并且您仍然面临问题,请轻松安装您面临的每个丢失的模块,全局示例

npm install -g config-chain npm install -g 配置链

This will re-install all missing modules, as this might have happened when you upgraded your node https://forum.ionicframework.com/t/cannot-find-module-config-chain/37130/7 "这将重新安装所有丢失的模块,因为升级节点时可能会发生这种情况https://forum.ionicframework.com/t/cannot-find-module-config-chain/37130/7

I encountered a different problem.我遇到了一个不同的问题。

It appears as though the Jenkins NodeJS plugin was incorrectly downloading and unpacking packages from the Node.js website.看起来Jenkins NodeJS 插件错误地从 Node.js 网站下载和解压包。 When I went to go look at the unzipped folder and did an npm list , there were several packages missing.当我去查看解压后的文件夹并执行npm list ,有几个包丢失了。

I fixed this by telling Jenkins to download a zip file directly and unpack it.我通过告诉 Jenkins 直接下载一个 zip 文件并解压它来解决这个问题。

It was the same issue.这是同样的问题。 I had moved NPM prefix to 'C:\\ProgramData\\npm\\' (you can see your prefix in 'npm config list' command).我已将 NPM 前缀移动到“C:\\ProgramData\\npm\\”(您可以在“npm config list”命令中看到您的前缀)。

After that I should install global packages only under the administrator credentials.之后,我应该只在管理员凭据下安装全局包。

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

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