node-sass ionic nodejs error fix

Posted on Updated on

Sometimes you go on a bug fixing journey and get no-where. Like always, when I find a solution to a lengthy problem, I write it up so I can remember it later.

I had this error show up, after doing an update to the latest version of Ionic, and for over an hour and a half, I upgraded NPM packages and everything, changed and updated code and got no-where.

I then went back and reverted to my last commit, rerun this command: (as found here)

node node_modules/node-sass/scripts/install.js

Where it eventually started working again.

Happy, but rather frustrated that it has to happen.

stephenmonro@SMMMacPro:~/ionicApps/project$ ionic serve
> ionic-app-scripts serve --address localhost --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[app-scripts] fs.js:114
[app-scripts] throw err;
[app-scripts] ^
[app-scripts] Error: ENOENT: no such file or directory, scandir '/Users/stephenmonro/ionicApps/project/node_modules/node-sass/vendor'
[app-scripts] at Object.readdirSync (fs.js:785:3)
[app-scripts] at Object.getInstalledBinaries (/Users/stephenmonro/ionicApps/project/node_modules/node-sass/lib/extensions.js:132:13)
[app-scripts] at foundBinariesList (/Users/stephenmonro/ionicApps/project/node_modules/node-sass/lib/errors.js:20:15)
[app-scripts] at foundBinaries (/Users/stephenmonro/ionicApps/project/node_modules/node-sass/lib/errors.js:15:5)
[app-scripts] at Object.module.exports.missingBinary (/Users/stephenmonro/ionicApps/project/node_modules/node-sass/lib/errors.js:45:5)
[app-scripts] at module.exports (/Users/stephenmonro/ionicApps/project/node_modules/node-sass/lib/binding.js:15:30)
[app-scripts] at Object.<anonymous> (/Users/stephenmonro/ionicApps/project/node_modules/node-sass/lib/index.js:14:35)
[app-scripts] at Module._compile (internal/modules/cjs/loader.js:701:30)
[app-scripts] at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
[app-scripts] at Module.load (internal/modules/cjs/loader.js:600:32)

[ERROR] ionic-app-scripts has unexpectedly closed (exit code 1).

The Ionic CLI will exit. Please check any output above for error details.
stephenmonro@SMMMacPro:~/ionicApps/project$ nodejs node_modules/node-sass/scripts/install.js
-bash: nodejs: command not found
stephenmonro@SMMMacPro:~/ionicApps/project$ node node_modules/node-sass/scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.1/darwin-x64-64_binding.node
Download complete
Binary saved to /Users/stephenmonro/ionicApps/project/node_modules/node-sass/vendor/darwin-x64-64/binding.node
stephenmonro@SMMMacPro:~/ionicApps/project$ ionic serve
> ionic-app-scripts serve --address localhost --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[app-scripts] [01:26:03] ionic-app-scripts 3.2.4

 

Also, another fun bug you could be chasing for a long this is to do with the .subscribe method.

“ERROR TypeError: Object(…) is not a function”.

For example, the following code:

this.httpClient.post( this.globals.apiserver + "post_user_track_location.php", trackstringdata, options)
.subscribe(data => { 
this.returned = data; 
//console.log (this.items); 
console.log (data); 
});

If you are running off a “localhost” change it to 127.0.0.1.

It may just work for you.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s