Ionic v1 Cannot find module './debug'

Hi, I’m just making some changes in an Ionic v1 app that I made 3 years ago, the main problem is that the Mac computer in which I developed that project is out of order, we made backup of the project, but you know the NPM, Cordova and Ionic global files aren’t present in that backup.

When I first run the project in my actual Mac High Sierra, I installed NPM, Cordova and Ionic, and did run Ionic server. The project is in v1, so I plan to keep this version, just wanted to do some CSS and HTML changes to the app.

But the Cordova had some issues when building the iOS or Android projects, so I started to search the errors on Google, trying to fix that errors.

Now, I can’t even start “ionic serve” on my machine. This is the error shown on the Terminal when I run “ionic serve”:

[v1] module.js:549
[v1]     throw err;
[v1]     ^
[v1] Error: Cannot find module './debug'
[v1]     at Function.Module._resolveFilename (module.js:547:15)
[v1]     at Function.Module._load (module.js:474:25)
[v1]     at Module.require (module.js:596:17)
[v1]     at require (internal/module.js:11:18)
[v1]     at Object.<anonymous> (/Applications/MAMP/htdocs/myProject/app3/node_modules/@ionic/v1-toolkit/node_modules/debug/src/node.js:14:28)
[v1]     at Module._compile (module.js:652:30)
[v1]     at Object.Module._extensions..js (module.js:663:10)
[v1]     at Module.load (module.js:565:32)
[v1]     at tryModuleLoad (module.js:505:12)
[v1]     at Function.Module._load (module.js:497:3)

[ERROR] A utility CLI has unexpectedly closed (exit code 1).
        
        The Ionic CLI will exit. Please check any output above for error details.

What is your ionic info output in the project?

Ionic:

ionic (Ionic CLI) : 4.1.2
Ionic Framework : ionic1 1.1.0
@ionic/v1-toolkit : 1.0.8

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : ios 4.5.5
Cordova Plugins : no whitelisted plugins (10 plugins total)

System:

ios-deploy : 2.0.0
NodeJS : v8.11.4 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 10.0 Build version 10A255

That doesn’t look to wrong.

Can you run the project with serve when creating a new one with ionic start --type ionic1?

I solved this one hour ago, but my member status didn’t let me publish the solution.

Finally I deleted the iOS platform and installed again, then made a “npm update”, and now the ionic serve works!

cordova platform rm ios
cordova platform add ios
npm update

And also delete de file “package-lock.json”, this is important. The system will generate a new one.

Thank you for your help!

1 Like