BarryWalsh
BarryWalsh

Reputation: 1340

Error: Cannot find module @ionic/cli-utils

I'm trying to run ionic in terminal and am getting the following error:

module.js:487
    throw err;
    ^

Error: Cannot find module '@ionic/cli-utils'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/dist/index.js:14:21)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

I've looked around on google but can't find any reason for the error. Any ideas?

Upvotes: 3

Views: 3377

Answers (3)

Taj Bist
Taj Bist

Reputation: 61

It also happened to me when updating new version. Solved It as:

  1. Delete node_modules
  2. Delete package-lock.json file
  3. Run npm install command
  4. ionic serve

Upvotes: 3

JSantaCL
JSantaCL

Reputation: 570

Happened to me when updating Ionic to it's latest version (currently 3.9.2). Solved it doing the following:

  • Delete package-lock.json file
  • Delete node_modules/ folder
  • Edit package.json file dependencies and devDependencies sections to:

    "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/core": "3.12.1",
        "@ionic-native/splash-screen": "3.12.1",
        "@ionic-native/status-bar": "3.12.1",
        "@ionic/storage": "2.0.1",
        "ionic-angular": "3.6.0",
        "ionicons": "3.0.0",
        "rxjs": "5.4.0",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.12"      
    },
    "devDependencies": {
        "@ionic/app-scripts": "2.1.3",
        "typescript": "2.3.4"
    }
    
  • Run npm install again
  • Edit script section in the www/index.html file:

    <script src="build/polyfills.js"></script>
    <script src="build/vendor.js"></script>
    <script src="build/main.js"></script>
    

Upvotes: 2

tao wang
tao wang

Reputation: 93

what is your ionic's version? please type some ionic info if is ionic3.x try npm i -g @ionic/cli-utils? i solved it,

Upvotes: 0

Related Questions