Search code examples
node.jsionic-frameworksassnode-sass

Ionic cannot build app due to node-sass error


I am trying to deploy my ionic app and it keeps throwing the following error:

ionic2Project@2.4.1 build /builds//awaken-app
> ionic-app-scripts build

/builds///node_modules/@ionic/app-scripts/node_modules/node-sass/lib/binding.js:15
      throw new Error(errors.missingBinary());
      ^

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

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

It seems to work with node-sass@4.12.0 but ionic-app-scripts has node-sass@4.10.0 in it's package.json.

When I attempt to rebuild node-sass locally, I see the following error:

$ npm rebuild node-sass

> node-sass@4.10.0 install /Users//node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.10.0/darwin-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.10.0/darwin-x64-72_binding.node": 

HTTP error 404 Not Found

Might be worth noting I am running node@12.8.1 and my mac is running OSX Mojave 10.14.6.


Solution

  • Node-sass doesn't support every combination with every release.

    Your command npm rebuild node-sass was correct, but you need to review the releases page to see what the right node-sass version for you is.

    Just upgrading to the latest doesn't always work.

    It says this on the npm package page:

    Supported Node.js versions vary by release, please consult the releases page

    So what this means is your particular combination might need you to downgrade to an older Node-sass by:

    1. Reviewing the releases page for the appropriate version
    2. editing your version in your package.json
    3. then doing npm install
    4. and then npm rebuild node-sass again.

    cloud machine update

    You have now mentioned that you are not building on your local computer, it is being done on a cloud computer.

    If this is some build service then you need to open a support ticket with them to get them to install support for you.

    If this is your own VM then you need to do the steps in my initial answer on that cloud computer.