Ionic-CLI failing all operations since 3.7.0 update

I’m trying to start a new project but can’t get ionic to start. Attempting serve or build commands on old projects fails as well.
Git-Bash says ‘ionic command not found’

cmd says:
'Cannot find module 'module.js:471
throw err;
^

Error: Cannot find module ‘C:\Users\Tofi\AppData\Roaming\npm\node_modules\ionic\bin\ionic’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:393:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:508:3’’

I’ve run yarn upgrade, yarn add and npm install commands, to no avail. They all claim a successful install.

The script file is present, but the entire node_modules\ionic folder is missing. Was it previously absent, or is this part of the change? Wouldn’t the install process add it?

How do I get this thing running again, preferably without downgrading?

Yeah lets start at the beginning:

Post your npm list -g --depth=0 output.
Post your ionic -v output.
Post your ionic info output outside a project.
Post your ionic info output inside your project.
Post your package.json of the project.

npm list:
PS C:\Users\Tofi> npm list -g --depth=0
C:\Users\Tofi\AppData\Roaming\npm
±- @angular/animations@4.1.3
±- @angular/cli@1.0.4
±- UNMET PEER DEPENDENCY @angular/common@4.0.0
±- UNMET PEER DEPENDENCY @angular/compiler@4.0.0
±- @angular/compiler-cli@4.1.3
±- UNMET PEER DEPENDENCY @angular/core@4.1.3
±- @angular/forms@4.1.3
±- @angular/http@4.1.3
±- UNMET PEER DEPENDENCY @angular/platform-browser@4.0.0
±- @angular/platform-browser-dynamic@4.0.0
±- @angular/platform-server@4.1.3
±- @angular/router@4.1.3
±- @ionic-native/camera@3.12.1
±- @ionic-native/core@3.6.0
±- @ionic-native/geolocation@3.12.1
±- @ionic-native/splash-screen@3.12.1
±- @ionic-native/status-bar@3.12.1
±- @ionic/cli-plugin-cordova@1.4.1
±- @ionic/storage@2.0.1
±- @types/core-js@0.9.42
±- @types/firebase@2.4.31
±- @types/mongoose@4.7.17
±- @types/node@7.0.31
±- angular-in-memory-web-api@0.3.2
±- angularfire2@4.0.0-rc.1
±- bootstrap@4.0.0-alpha.6
±- cordova@7.0.1
±- core-js@2.4.1
±- create-react-class@15.6.0
±- create-react-native-app@0.0.6
±- express@4.15.3
±- express-generator@4.15.0
±- firebase@4.1.1
±- firebase-admin@5.0.0
±- firebase-tools@3.9.1
±- error: ENOENT: no such file or directory, open 'C:\Users\Tofi\AppData\Roaming\npm\node_modules\ionic\package.json
±- mean-cli@0.12.15
±- mongodb@2.2.28
±- mongoose@4.10.6
±- nodemon@1.11.0
±- npm-install-missing@0.1.4
±- npm-install-peers@1.1.0
±- prop-types@15.5.10
±- react@16.0.0-alpha.12
±- react-native-cli@2.0.1
±- rxjs@5.0.1
±- typescript@2.3.4
±- typescript-require@0.2.9-1
`-- zone.js@0.8.4

npm ERR! peer dep missing: @angular/common@4.1.3, required by @angular/forms@4.1.3
npm ERR! peer dep missing: @angular/common@4.1.3, required by @angular/platform-server@4.1.3
npm ERR! peer dep missing: @angular/common@4.1.3, required by @angular/router@4.1.3
npm ERR! peer dep missing: @angular/compiler@4.1.3, required by @angular/compiler-cli@4.1.3
npm ERR! peer dep missing: @angular/compiler@4.1.3, required by @angular/platform-server@4.1.3
npm ERR! peer dep missing: @angular/core@4.0.0, required by @angular/common@4.0.0
npm ERR! peer dep missing: @angular/core@4.0.0, required by @angular/compiler@4.0.0
npm ERR! peer dep missing: @angular/core@4.0.0, required by @angular/platform-browser@4.0.0
npm ERR! peer dep missing: @angular/core@4.0.0, required by @angular/platform-browser-dynamic@4.0.0
npm ERR! peer dep missing: @angular/platform-browser@4.1.3, required by @angular/forms@4.1.3
npm ERR! peer dep missing: @angular/platform-browser@4.1.3, required by @angular/http@4.1.3
npm ERR! peer dep missing: @angular/platform-browser@4.1.3, required by @angular/platform-server@4.1.3
npm ERR! peer dep missing: @angular/platform-browser@4.1.3, required by @angular/router@4.1.3
npm ERR! error in C:\Users\Tofi\AppData\Roaming\npm\node_modules\ionic: ENOENT: no such file or directory, open ‘C:\User
s\Tofi\AppData\Roaming\npm\node_modules\ionic\package.json’

Everything else gives the same error:
module.js:471
throw err;
^

Error: Cannot find module ‘C:\Users\Tofi\AppData\Roaming\npm\node_modules\ionic\bin\ionic’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:393:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:508:3

and the package.json:
{
“name”: “myproj”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},
“dependencies”: {
@angular/common”: “4.1.3”,
@angular/compiler”: “4.1.3”,
@angular/compiler-cli”: “4.1.3”,
@angular/core”: “4.1.3”,
@angular/forms”: “4.1.3”,
@angular/http”: “4.1.3”,
@angular/platform-browser”: “4.1.3”,
@angular/platform-browser-dynamic”: “4.1.3”,
@ionic-native/camera”: “3.12.1”,
@ionic-native/core”: “3.12.1”,
@ionic-native/google-maps”: “3.12.1”,
@ionic-native/splash-screen”: “3.12.1”,
@ionic-native/status-bar”: “3.12.1”,
@ionic/cloud-angular”: “^0.12.0”,
@ionic/storage”: “2.0.1”,
@ngx-translate/core”: “6.0.1”,
@ngx-translate/http-loader”: “0.0.3”,
“cordova-android”: “^6.2.3”,
“cordova-plugin-console”: “^1.0.5”,
“cordova-plugin-device”: “^1.1.4”,
“cordova-plugin-splashscreen”: “^4.0.3”,
“cordova-plugin-statusbar”: “^2.2.2”,
“cordova-plugin-whitelist”: “^1.3.1”,
“ionic-angular”: “3.5.2”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“rxjs”: “5.4.0”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.12”
},
“devDependencies”: {
@ionic/app-scripts”: “2.0.2”,
@ionic/cli-plugin-cordova”: “^1.5.0”,
@ionic/cli-plugin-ionic-angular”: “^1.4.0”,
“ionic”: “3.6.0”,
“typescript”: “2.3.4”
},
“description”: “Awesome Ionic App”,
“cordova”: {
“plugins”: {
“cordova-plugin-console”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-whitelist”: {},
“ionic-plugin-keyboard”: {}
},
“platforms”: [
“android”
]
}
}

That is strange - are you also developing your project in that C:\User s\Tofi\AppData\Roaming\npm folder?
All these packages shouldn’t be there, only cordova and ionic (and maybe a few else you installed for other things).

I would advise you to just get rid of your current npm and node installations and install nvm-windows. Then use it to install a new node, then install ionic and cordova again with npm i -g cordova ionic. Then your npm list -g --depth=0 should be much cleaner.

And then also your project should work again.

Thanks. It works now

What did you do exactly?

I wiped node, used nvm windows to install the latest node and installed ionic and cordova again.
I also realized node and npm hadn’t been updating (maybe due to my firewall)- the new install brought node to 8.2.1 from ~6.4 and npm to 5.3.0 from ~4.1

1 Like

Hi, I’m having the same issue as you , ever since the 3.7.0 update my projects aren’t able to run at all. What exactly did you do ? What commands did you run ? Could you be specific

it isn’t pretty. Run npm cache clean --force. Uninstall node, delete the nodejs folder in program files and the npm folder in AppData/roaming. Then install nvm windows- the docs on downloading, installing and using it are on github. Run nvm install latest to update node and then nvm use <version> to select it. From there you can start reinstalling all the npm packages with npm install. Should work fine after.

1 Like