Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic Error: Cannot find module 'dezalgo'

i am trying to add the ios platform to my project so i can build it in XCode. I ran the following command: ionic cordova platform add ios

this is the error i got:

ionic cordova platform add ios
> cordova platform add ios --save
module.js:544
    throw err;
    ^

Error: Cannot find module 'dezalgo'
    at Function.Module._resolveFilename (module.js:542:15)
    at Function.Module._load (module.js:472:25)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/chando/Documents/GIT/testproject/node_modules/cordova-lib/node_modules/npm/lib/utils/correct-mkdir.js:2:15)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
[ERROR] Exception: 

i have tried multiple variations of deleting node_modules, installing the latest version of ionic, npm etc to no avail.

Has anyone else encountered this?

this is my ionic info:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : not installed

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.9.2

System:

Node  : v9.2.1
npm   : 5.6.0 
OS    : macOS Sierra
Xcode : Xcode 9.2 Build version 9C40b 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro
like image 423
Chad Avatar asked Jul 21 '26 00:07

Chad


2 Answers

I had this issue come up after updating to the latest Ionic/Angular for my project this morning. This a work-around, but it worked for me:

  1. Add "dezalgo": "~1.0" to your devDependencies section of package.json
  2. Run npm prune
  3. Run npm install
  4. Build your project

I can't tell you why it works other than to guess that somewhere in all of the NPM modules somebody forgot to include this dependency. I should also note that I updated my global modules as well, but I doubt that that would have had any influence on this.

like image 123
MBielski Avatar answered Jul 22 '26 15:07

MBielski


I'm using Node.js 9.7.0 and npm 5.6.0.

Doing a clean install with rm -rf node_modules && npm install also solves this error.

At the time of writing, the issue is still not fixed. Numerous people are complaining about this dezalgo error on several GitHub issue boards:

  • nodejs/node #13492
  • npm/npm #8635
  • npm/dezalgo #7
  • tjunnone/npm-check-updates #420

EDIT: this issue seems to appear when one of the dependencies relies on an older npm version (such as david or npm-check-updates packages).

like image 38
CedX Avatar answered Jul 22 '26 15:07

CedX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!