Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node npm install -g cannot find module config-chain

Tags:

node.js

npm

I configured the node plugins on jenkins to install grunt and bower globally.

When i use it on a project npm install is executed:

 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.

Any ideas how to fix this?

Edit.: Fixed it thanks to the accepted answer:

npm auto-install isnt supported for mac at this time. I had to download the package manually.

like image 451
Ostkontentitan Avatar asked Feb 17 '14 08:02

Ostkontentitan


3 Answers

config-chain is npm dependency, so chances are that your npm installation is broken.

Try to reinstall it, or use one of npm forks if npm itself isn't installable on your system for some reason.

like image 148
alex Avatar answered Oct 12 '22 23:10

alex


Follow this suggest, i resolve it. "Who ever faces this problem, please do a clean install of ionic"

npm install -g ionic

If it got installed and you're still facing issues, easily install each missing module you face, globally example

npm install -g config-chain

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"

like image 41
L.Tian Avatar answered Oct 12 '22 23:10

L.Tian


I encountered a different problem.

It appears as though the Jenkins NodeJS plugin was incorrectly downloading and unpacking packages from the Node.js website. When I went to go look at the unzipped folder and did an npm list, there were several packages missing.

I fixed this by telling Jenkins to download a zip file directly and unpack it.

like image 34
Evan Avatar answered Oct 13 '22 00:10

Evan