Cannot find module 'internal/errors' ionic

Viewed 2282

I'm trying to create new ionic project.then it show below error. i have removed nodejs,npm ,ionic and re install again.but same error showing again. Terminal

Error

Error: Cannot find module 'internal/errors'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:476:23)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at evalmachine.<anonymous>:36:16
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/unzip/node_modules/fstream/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)

Cannot find module 'internal/errors' (CLI v1.7.16)

My System info

Cordova CLI: 7.0.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS 
Node Version: v8.5.0
3 Answers

I was able to go to the node "LTS" version of 6.4.11 with nvm to get things to work.

$ VER=v6.11.4
$ nvm install $VER
$ nvm alias default $VER
$ nvm use $VER
### now, sadly, we re-install everything to avoid incompatibilities and other issues.
$ mv node_modules node_modules.old
$ mv *.lock node_modules.old
$ npm install
$ npm -g install ionic@1.7 cordova@6 gulp
### the next two may not be needed but it's mostly harmless and maybe helpful 
$ ionic platform remove android
$ ionic platform add android

Now when running those same commands, if you're lucky now you'll get a warning instead:

 ✗ (node:15169) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

Which is not a crash ... no, it's not a crash ...

Finally, fear not, there's other exciting fixes and incompatilibites to look forward to after this. Usually those should be in other questions but because you'll probably need those answers as well I've documented them here.

You're likely going to have to also add

ext.cdvCompileSdkVersion = 26
android {
   buildToolsVersion "26.0.1"
   packagingOptions {
      exclude 'META-INF/LICENSE'
   }
}

to your build somehow. One way is to put this into a file named build-extras.gradle which lives in platforms/android.

Note to future readers (2018+): There's nothing magical about "26" - this is the current highest sdk version number as of this writing. You should likely use whatever the current version is in your world of tomorrow if the values above don't work for you.

However, since anything in platforms/ might be removed by cordova in the cordova platform add/remove pattern, to make sure I keep it around, I put it outside that folder. Then in my build, which is just a shell script, I do this:

cp -up misc/build-extras.gradle platforms/android
ionic build android

And now finally I'm back in business.

I have this problem,too I install the last version of ionic and in terminal :

ionic start myproject --type ionic1

this command create project

Related