ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

"Error: Cannot find module 'config-chain'" when running 'ionic start'

Open tayanderson opened this issue 11 years ago • 14 comments

When I try to create an ionic project using ionic start myApp, I get this error:

Error: Cannot find module 'config-chain'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/Taylor/.npm-packages/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/ionic-cordova-lib/node_modules/npm/lib/config/core.js:2:10)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)

Cannot find module 'config-chain' (CLI v1.7.10)

Your system information:

Cordova CLI: Not installed
Ionic CLI Version: 1.7.10
Ionic App Lib Version: 0.6.5
ios-deploy version: Not installed
ios-sim version: 5.0.3 
OS: Mac OS X El Capitan
Node Version: v5.0.0
Xcode version: Xcode 7.1.1 Build version 7B1005

Apparently, cordova isn't installing, but I don't know why. I've tried running npm install -g cordova several times (with and w/o sudo) but it keeps telling me that cordova isn't installed.

tayanderson avatar Nov 19 '15 02:11 tayanderson

We get this too. Might be a problem with the latest shrinkwrap?

codeincontext avatar Nov 19 '15 13:11 codeincontext

Related: #647

Seems to affect v1 too.

brandyscarney avatar Nov 19 '15 15:11 brandyscarney

I think in our case we were able to resolve this by updating to the latest Node

codeincontext avatar Nov 19 '15 15:11 codeincontext

Also related: http://forum.ionicframework.com/t/cannot-find-module-config-chain/37130

Can you try some of the solutions mentioned on this post and see if those work?

brandyscarney avatar Nov 19 '15 15:11 brandyscarney

Here is my info for comparison:

$ npm -v
2.10.1
$ node -v
v0.12.4

$ ionic info

Your system information:

Cordova CLI: 5.3.3
Gulp version:  CLI version 3.9.0
Gulp local:
Ionic CLI Version: 1.7.10
Ionic App Lib Version: 0.6.5
ios-deploy version: Not installed
ios-sim version: 5.0.3
OS: Mac OS X El Capitan
Node Version: v0.12.4
Xcode version: Xcode 6.4 Build version 6E35b

brandyscarney avatar Nov 19 '15 15:11 brandyscarney

I tried to downgrade and upgrade node, reinstall ionic and cordova but now I get a different error when I try to run anything with ionic.

So, ionic info gave me this:

module.js:339
    throw err;
    ^

Error: Cannot find module 'file-utils'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/Taylor/.npm-packages/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/archiver/lib/util/index.js:17:13)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

tayanderson avatar Nov 19 '15 16:11 tayanderson

@tayanderson does running npm cache clean and then reinstalling do anything?

tlancina avatar Nov 19 '15 17:11 tlancina

running npm cache clean seemed to fix the ionic issue. Now, I think I'm having an issue with Cordova. I am able to create a ionic project now, but I get errors when I try to run ionic add platform and ionic build.

It for some reason, keeps telling me that Cordova is not installed.

when I run ionic info:

Your system information:

Cordova CLI: Not installed
Ionic CLI Version: 1.7.10
Ionic App Lib Version: 0.6.5
ios-deploy version: Not installed
ios-sim version: 5.0.3 
OS: Mac OS X El Capitan
Node Version: v5.0.0
Xcode version: Xcode 7.1.1 Build version 7B1005 

******************************************************
 Dependency warning - for the CLI to run correctly,      
 it is highly suggested to install/upgrade the following:     

 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`
 Install ios-deploy to deploy iOS applications to devices. `npm install -g ios-deploy` (may require sudo)

******************************************************

when I run ionic add platform ios:

Failed to find the bower component "platform".
Are you sure it exists? (CLI v1.7.10)

ionic build ios

Error happened { [Error: ENOENT: no such file or directory, open '/Users/Taylor/config.xml']
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/Taylor/config.xml' }
Error: ENOENT: no such file or directory, open '/Users/Taylor/config.xml'
    at Error (native)

tayanderson avatar Nov 19 '15 19:11 tayanderson

First error: I'm not sure, it sounds like there is something funky going on with npm on your system.

Second error: the command is ionic platform add so just switch them around and you should be good to go.

Third error: you might need to cd into your project directory, it looks like you're running that command outside of a project. For example, after doing ionic start myApp you'll need to cd myApp before you can run platform specific commands (I do this almost every time I start a new project).

I've opened a new issue for it: https://github.com/driftyco/ionic-cli/issues/658, since we should really be giving more descriptive errors in this case.

tlancina avatar Nov 19 '15 19:11 tlancina

Oops, sorry. Didn't notice that I entered the command wrong and didn't cd...

Well, I am no longer getting the 'config-chain' so I think running npm clear cache fixed that problem for me.

tayanderson avatar Nov 19 '15 20:11 tayanderson

Fixing this error: Open a new command line and follow these steps: http://ionicframework.com/getting-started/

Command: $ npm install -g cordova ionic Will download the components you are missing.

Russell32 avatar Nov 26 '15 04:11 Russell32

If you are a Windows user and using command line, after running npm cache clean or/both npm install -g cordova ionic you should restart the command line.

srht avatar Apr 26 '16 09:04 srht

can't platform add in ionic project .................................................................................................................................................................................................................. C:\Users\TuppleApps\Desktop\firebase\ionic-firebase>ionic build android You're trying to build for android but don't have the platform installed yet. ? Installing android for you. Installing cordova-plugin-device Installing cordova-plugin-console Installing cordova-plugin-whitelist Installing cordova-plugin-splashscreen Installing cordova-plugin-statusbar Installing ionic-plugin-keyboard Error: Command failed: C:\Windows\system32\cmd.exe /s /c "cordova plugin add --save ionic-plugin-keyboard" Error: Cannot find module 'config-chain'

at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:829:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:486:12)

srjahir32 avatar Oct 18 '16 10:10 srjahir32

Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.

Thank you for using Ionic!

ionitron-bot[bot] avatar Jul 12 '18 16:07 ionitron-bot[bot]