Using Ionic View fo first time, node-sass breaks build


#1

I’m looking to use Ionic View for the first time but have not been able to get it to work. I’ve searched for quite a few hours and my understanding is that Node-sass is preventing it from building on Ionic Pro/View.

I feel like because I am on a Mac and Ionic Pro/View is on Linux, that “npm node-sass rebuild” needs to be run each time the app is pushed/uploaded to the Ionic Pro/View. If this is correct, how do I tell the Ionic or node to run that upon build?

Is it a gulp task or ssh-ing directly into the server that ionic uses for my app? To be clear, I have never worked with gulp.

Error: Missing binding /usr/src/app/node_modules/@ionic/app-scripts/node_modules/node-sass/vendor/linux-x64-57/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 8.x

Found bindings for the following environments:
  - OS X 64-bit with Node.js 6.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
    at module.exports (/usr/src/app/node_modules/@ionic/app-scripts/node_modules/node-sass/lib/binding.js:15:13)
    at Object. (/usr/src/app/node_modules/@ionic/app-scripts/node_modules/node-sass/lib/index.js:14:35)
    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)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object. (/usr/src/app/node_modules/@ionic/app-scripts/dist/core/bundle-components.js:6:16)
npm info lifecycle rally@0.0.1~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rally@0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the rally@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gitlab-runner/.npm/_logs/2017-12-30T22_33_47_603Z-debug.log
npm run build failed
Running after script...
$ run "clean-up"
Running Stage clean-up for Job: 5199320
ERROR: Job failed: exit status 1
TermsPrivacy Policy© 2017 Drifty Co.  v0.0.439
IonicDocsBlogHelp & SupportStatus


#2

Use the current Node LTS.


#3

I went ahead and added that to my Mac, but how do I add it to my ionic project? I see under @ionic-native/core, there are several different nodeVersions under different modules. Should I simply do a find and replace for all, or is there a better way?


#4

Cleanest way is to install nvm, and then install the LTS as an nvm partition. You only want one Node version available at a time. Otherwise, who knows what the source of your compile errors might be.


#5

You lost me, unfortunately. All I need for it to work is for ‘npm rebuild node-sass’ to be used whenever I’m building/serving the ionic project on an unfamiliar (non-mac) server. That’s all I needed to do when I ‘served’ it on my school’s linux server.

I understand that I should only have one version of node at a time, hence node version manager, but I’m not sure your instructions are clear enough to help me. Thank you for the replies, though.