Getting internal/fs error when trying to compile project or start new project


#1

Hi…not certain what or when things went sideways but I am now getting the following error when trying to compile an existing project or even just create a new one from scratch. I am intentionally on Ionic v.1.7.16 because all of my code works and I am not ready to invest the time into revamping my entire app to handle AngularJS 2 or Ionic v2+.

iMac:dev test$ ionic start TempProj1 tabs

Error: Cannot find module 'internal/fs’
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 evalmachine.:40:20
at Object. (/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:569:30)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)

Cannot find module ‘internal/fs’ (CLI v1.7.16)

Your system information:

Cordova CLI: 7.0.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.9.1
ios-sim version: 6.0.0
OS: Mac OS X El Capitan
Node Version: v8.1.3
Xcode version: Xcode 8.2.1 Build version 8C1002

I blew away my entire installation of node/npm and reinstalled everything from scratch and still got the same error. The only new thing I notice that was different than before is that now I have to use sudo simply to get the npm -v
iMac:dev test$ npm -v
5.0.3

┌────────────────────────────┐
│ npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /Users/test/.config │
└───────────────────────────

Even though I get the version number I never got that npm error before…now I have to do this:

iMac:dev test$ sudo npm -v
Password:
5.0.3

I don’t know whats going on. Others with similar errors have said delete node_modules and reinstall npm…but I completely blew mine away and reinstalled everything and its still not working.


#2

I would suggest using nvm to manage node versions without ever needing superuser privileges.


#3

Before I blew everything away and reinstalling from scratch I just used npm itself and I got that npm -v issue and the error. When I did the reinstall I used n instead but still got all the same errors and npm -v issue.

Aside from the npm -v issue, any insights into the actual internal/fs issue?


#4

If you need sudo just to be able to access your node installation at all, it’s hopelessly broken and really nothing else anybody can suggest will be of any value until you get that under control.