Cordova platform save can't find fstream

colinmc@COLINMCs-Air:~/code/dashboard$ ionic cordova platform save

cordova platform save
:heavy_multiplication_x: Running command - failed!
[ERROR] An error occurred while running cordova platform save (exit code 1):

    Error: Cannot find module 'fstream'

Ionic info:

cli packages: (/Users/colinmc/Code/dashboard/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1 

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.6.0

System:

Node  : v8.4.0
npm   : 5.4.0 
OS    : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b

Do you also have a question or did you just want to tell us about this?

Your ionic info indicates you have no platforms.

Please run the same command with --verbose -- -d to see if we get more useful output.

Adding platforms does not work. It looks like something to do with path. Here’s the verbose output when I try
ionic cordova platform add ios.

[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: ‘/Users/colinmc/Code/dashboard’, local: true, binPath:
’/usr/local/lib/node_modules/ionic/bin/ionic’, libPath:
’/Users/colinmc/Code/dashboard/node_modules/ionic/dist/index.js’ }

cordova platform add ios --save
:heavy_multiplication_x: Running command - failed!
[ERROR] Exception: Error: Cannot find module ‘fstream’

You did npm install?

What about cordova platform add ios?

Yes I did npm install. cordova platform add ios gives similar error. I tried npm uninstall and reinstalled using npm and still get the same error.

Faster than further debugging this:
Uninstall your node, install nvm (or nvm-windows when you are using Windows), install a new node with this, then install ionic and cordova again and try your command again. The problem should be gone.

Thanks. This looks like it’s working now. Thanks heaps.

1 Like