Node-Sass binding environment - Ionic Pro Building Error


#1

Boy this is a messy one. I’ve tried removing node modules and reinstalling, rebuilding node-sass, downgrading node-sass, so I can’t help but think this is on the Ionic Pro side. Here’s my stack trace from the Ionic Pro failed build.

Running with gitlab-ci-multi-runner 9.1.0 (0118d89)
  on Snapshot Builds (c9648220)
Using Shell executor...
Running on ip-10-2-1-50...
Cloning repository...
Cloning into '/home/gitlab-runner/builds/c9648220/0/project-1'...
Checking out 2599d64b as master...
Skipping Git submodules setup
$ run "fetch-updates"
Running Job: 5155960
Checking for build process updates...
$ run "build-app"
Running Job: 5155960
Attempting to restore cached packages...
Package cache restored!
$ npm run build
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.2.1
npm info lifecycle paths@0.0.1~prebuild: paths@0.0.1
npm info lifecycle paths@0.0.1~build: paths@0.0.1

> paths@0.0.1 build /usr/src/app
> ionic-app-scripts build

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

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 8.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 paths@0.0.1~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paths@0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR! 

Build works totally fine on my Mac. I think it’s trying to build with Linux on the server side and running into issues.

ionic-info:

cli packages: (/Users/user/Desktop/Development/Paths/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.5
    Cordova Platforms  : android 6.2.3 browser ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    ios-deploy : 1.9.1
    ios-sim    : 6.1.2
    Node       : v8.2.1
    npm        : 5.3.0
    OS         : macOS High Sierra
    Xcode      : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

Any help?


#2

I’m having the SAME issue… i really don’t know how to get around it


#3

Working on it now, I’ll let you know if I find a fix


#4

Looks like a server side thing to me. You should probably report it to Ionic via the Ionic Pro support system.


#5

Welp, I managed to get it built somehow.

I reverted back to my last successful build’s package.json and package-lock.json, removed node_modules, then npm installed, and it built normally again. So I’m going to assume it has something to do with a random package I installed or upgraded. Still can’t figure out why it would think my environment is Linux but guess it’s working now.

I can post my before and after package.json if you want to analyze it.


#6

I’d appreciate the before and after! Also, it’s looking for linux because it’s being built on the server, not on your machine when you push it via git.


#7

Before(Failure):

{
  "name": "paths",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "^4.4.3",
    "@angular/compiler": "^4.4.3",
    "@angular/compiler-cli": "^4.4.3",
    "@angular/core": "^4.4.3",
    "@angular/forms": "^4.4.3",
    "@angular/http": "^4.4.3",
    "@angular/material": "^5.0.0",
    "@angular/platform-browser": "^4.4.3",
    "@angular/platform-browser-dynamic": "^4.4.3",
    "@auth0/cordova": "^0.2.0",
    "@firebase/webchannel-wrapper": "0.2.1",
    "@ionic-native/camera": "^4.2.1",
    "@ionic-native/core": "^4.4.2",
    "@ionic-native/facebook": "^4.4.2",
    "@ionic-native/file": "^4.2.1",
    "@ionic-native/file-chooser": "^4.2.1",
    "@ionic-native/file-path": "^4.2.1",
    "@ionic-native/geolocation": "^4.4.2",
    "@ionic-native/keyboard": "^4.2.1",
    "@ionic-native/native-page-transitions": "^4.3.2",
    "@ionic-native/safari-view-controller": "^4.2.1",
    "@ionic-native/splash-screen": "3.12.1",
    "@ionic-native/status-bar": "^3.14.0",
    "@ionic/storage": "2.0.1",
    "@mapbox/geojson-area": "^0.2.2",
    "@mapbox/mapbox-gl-directions": "^3.1.2",
    "@mapbox/point-geometry": "^0.1.0",
    "@mapbox/shelf-pack": "^3.1.0",
    "@mapbox/unitbezier": "0.0.0",
    "@mapbox/vector-tile": "^1.3.0",
    "@mapbox/whoots-js": "^3.0.0",
    "angular": "^1.6.7",
    "angular-cli": "^1.0.0-beta.28.3",
    "angularfire2": "^5.0.0-rc.0",
    "animate.css": "^3.5.2",
    "auth0-js": "^8.9.3",
    "cities.json": "^1.1.0",
    "com.telerik.plugins.nativepagetransitions": "^0.6.5",
    "cordova-android": "6.2.3",
    "cordova-ios": "4.5.4",
    "cordova-plugin-add-swift-support": "^1.7.0",
    "cordova-plugin-browsertab": "^0.2.0",
    "cordova-plugin-buildinfo": "^1.1.0",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-compat": "^1.1.0",
    "cordova-plugin-crosswalk-webview": "^2.3.0",
    "cordova-plugin-customurlscheme": "^4.3.0",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-facebook4": "^1.7.4",
    "cordova-plugin-file": "^4.3.3",
    "cordova-plugin-filechooser": "^1.0.1",
    "cordova-plugin-filepath": "^1.0.2",
    "cordova-plugin-geolocation": "^2.4.3",
    "cordova-plugin-inappbrowser": "^1.7.1",
    "cordova-plugin-ionic": "^1.1.8",
    "cordova-plugin-ionic-keyboard": "^1.0.5",
    "cordova-plugin-ionic-webview": "^1.1.16",
    "cordova-plugin-safariviewcontroller": "^1.4.7",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "git+https://github.com/apache/cordova-plugin-statusbar.git",
    "cordova-plugin-whitelist": "^1.3.1",
    "cordova-plugin-wkwebview-engine": "^1.1.4",
    "cordova-universal-links-plugin": "^1.2.1",
    "firebase": "^4.6.0",
    "har-validator": "^5.1.0",
    "ionic-angular": "^3.9.2",
    "ionic-native": "^2.9.0",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic-tags-input": "0.0.6",
    "ionic2-rating": "^1.2.2",
    "ionic2-super-tabs": "^4.1.5",
    "ionicons": "3.0.0",
    "jshint": "^2.9.5",
    "minimatch": "^3.0.4",
    "node-sass": "^4.7.2",
    "promise-polyfill": "6.0.2",
    "rxjs": "^5.5.5",
    "sw-toolbox": "3.6.0",
    "typescript": "^2.4.0",
    "webpack": "^2.7.0",
    "zone.js": "^0.8.17"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.5",
    "ionic": "3.19.0",
    "mapbox-gl": "^0.28.0"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-safariviewcontroller": {},
      "cordova-plugin-customurlscheme": {
        "URL_SCHEME": "",
        "ANDROID_SCHEME": "",
        "ANDROID_HOST": "",
        "ANDROID_PATHPREFIX": ""
      },
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-buildinfo": {},
      "cordova-universal-links-plugin": {},
      "cordova-plugin-browsertab": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-ionic": {
        "APP_ID": "",
        "CHANNEL_NAME": "",
        "UPDATE_METHOD": "background",
        "UPDATE_API": "https://api.ionicjs.com",
        "MAX_STORE": "2"
      },
      "cordova-plugin-camera": {
        "CAMERA_USAGE_DESCRIPTION": " ",
        "PHOTOLIBRARY_USAGE_DESCRIPTION": " "
      },
      "cordova-plugin-filechooser": {},
      "cordova-plugin-filepath": {},
      "cordova-plugin-file": {},
      "cordova-plugin-ionic-keyboard": {},
      "com.telerik.plugins.nativepagetransitions": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-crosswalk-webview": {
        "XWALK_VERSION": "23+",
        "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
        "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
        "XWALK_MODE": "embedded",
        "XWALK_MULTIPLEAPK": "true"
      },
      "ionic-plugin-keyboard": {},
      "cordova-plugin-wkwebview-engine": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To find your current city and state"
      },
      "cordova-plugin-facebook4": {
        "APP_ID": "",
        "APP_NAME": ""
      },
      "cordova-plugin-compat": {}
    },
    "platforms": [
      "android",
      "ios"
    ]
  }
}

After(Success):

{
    "name": "paths",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "^4.4.3",
        "@angular/compiler": "^4.4.3",
        "@angular/compiler-cli": "^4.4.3",
        "@angular/core": "^4.4.3",
        "@angular/forms": "^4.4.3",
        "@angular/http": "^4.4.3",
        "@angular/platform-browser": "^4.4.3",
        "@angular/platform-browser-dynamic": "^4.4.3",
        "@auth0/cordova": "^0.2.0",
        "@firebase/webchannel-wrapper": "0.2.1",
        "@ionic-native/camera": "^4.2.1",
        "@ionic-native/core": "3.12.1",
        "@ionic-native/facebook": "^4.4.2",
        "@ionic-native/file": "^4.2.1",
        "@ionic-native/file-chooser": "^4.2.1",
        "@ionic-native/file-path": "^4.2.1",
        "@ionic-native/geolocation": "^4.4.2",
        "@ionic-native/keyboard": "^4.2.1",
        "@ionic-native/native-page-transitions": "^4.3.2",
        "@ionic-native/safari-view-controller": "^4.2.1",
        "@ionic-native/splash-screen": "3.12.1",
        "@ionic-native/status-bar": "^3.12.1",
        "@ionic/storage": "2.0.1",
        "@mapbox/mapbox-gl-directions": "^3.1.2",
        "angularfire2": "^5.0.0-rc.0",
        "animate.css": "^3.5.2",
        "auth0-js": "^8.9.3",
        "cities.json": "^1.1.0",
        "com.telerik.plugins.nativepagetransitions": "^0.6.5",
        "cordova-android": "^6.2.3",
        "cordova-browser": "^4.1.0",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-add-swift-support": "^1.7.0",
        "cordova-plugin-browsertab": "^0.2.0",
        "cordova-plugin-buildinfo": "^1.1.0",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.1.0",
        "cordova-plugin-crosswalk-webview": "^2.3.0",
        "cordova-plugin-customurlscheme": "^4.3.0",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-facebook4": "^1.9.1",
        "cordova-plugin-file": "^4.3.3",
        "cordova-plugin-filechooser": "^1.0.1",
        "cordova-plugin-filepath": "^1.0.2",
        "cordova-plugin-geolocation": "^2.4.3",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-ionic": "^1.1.8",
        "cordova-plugin-ionic-keyboard": "^1.0.5",
        "cordova-plugin-ionic-webview": "^1.1.16",
        "cordova-plugin-safariviewcontroller": "^1.4.7",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "git+https://github.com/apache/cordova-plugin-statusbar.git",
        "cordova-plugin-whitelist": "^1.3.1",
        "cordova-plugin-wkwebview-engine": "^1.1.4",
        "cordova-universal-links-plugin": "^1.2.1",
        "firebase": "^4.6.0",
        "har-validator": "^5.1.0",
        "ionic-angular": "^3.8.0",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionic-tags-input": "0.0.6",
        "ionic2-rating": "^1.2.2",
        "ionic2-super-tabs": "^4.1.5",
        "ionicons": "3.0.0",
        "jshint": "^2.9.5",
        "node-sass": "^4.7.2",
        "promise-polyfill": "6.0.2",
        "rxjs": "^5.4.3",
        "sw-toolbox": "3.6.0",
        "typescript": "^2.4.0",
        "zone.js": "^0.8.17"
    },
    "devDependencies": {
        "@ionic/app-scripts": "^3.0.1",
        "ionic": "3.19.0",
        "mapbox-gl": "^0.40.1"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-safariviewcontroller": {},
            "cordova-plugin-customurlscheme": {
                "URL_SCHEME": "",
                "ANDROID_SCHEME": "",
                "ANDROID_HOST": "",
                "ANDROID_PATHPREFIX": ""
            },
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-whitelist": {},
            "cordova-plugin-buildinfo": {},
            "cordova-universal-links-plugin": {},
            "cordova-plugin-browsertab": {},
            "cordova-plugin-inappbrowser": {},
            "cordova-plugin-ionic": {
                "APP_ID": "",
                "CHANNEL_NAME": "",
                "UPDATE_METHOD": "background",
                "UPDATE_API": "https://api.ionicjs.com",
                "MAX_STORE": "2"
            },
            "cordova-plugin-camera": {
                "CAMERA_USAGE_DESCRIPTION": " ",
                "PHOTOLIBRARY_USAGE_DESCRIPTION": " "
            },
            "cordova-plugin-filechooser": {},
            "cordova-plugin-filepath": {},
            "cordova-plugin-file": {},
            "cordova-plugin-ionic-keyboard": {},
            "com.telerik.plugins.nativepagetransitions": {},
            "cordova-plugin-ionic-webview": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-crosswalk-webview": {
                "XWALK_VERSION": "23+",
                "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
                "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
                "XWALK_MODE": "embedded",
                "XWALK_MULTIPLEAPK": "true"
            },
            "ionic-plugin-keyboard": {},
            "cordova-plugin-wkwebview-engine": {},
            "cordova-plugin-geolocation": {
                "GEOLOCATION_USAGE_DESCRIPTION": "To find your current city and state"
            },
            "cordova-plugin-facebook4": {
                "APP_ID": "",
                "APP_NAME": ""
            }
        },
        "platforms": [
            "android",
            "browser",
            "ios"
        ]
    }
}

#8

I’ve ran back into this issue. I submitted a support ticket with the Ionic Pro team yesterday, might create a github issue with node-sass as well. Let me know if you can find a solution.


#9

I created a ticket as well the day you originally posted so let’s keep this thread updated. I noticed another post regarding this too so hopefully it will get some attention.


#10

Here’s what I got back from support, fixed my issue!

Thanks for reaching out to the Ionic Pro support team.

I had a look and I see you’re committing your node-modules/ dir. Your Ionic Pro repo shouldn’t include any of the dirs generated at build. Replace your .gitignore with the default located at https://github.com/ionic-team/ionic2-app-base/blob/master/.gitignore

Feel free to make any necessary additions but don’t remove any of the default ignored dirs. After recreating .gitignore run the following commands.

git rm -r --cached .
git add .

Push the changes up to your Pro account and see if that does the trick. I’d also recommend running the ionic doctor check command.


#11

This has solved my issue I was facing for months with Ionic Pro builds
Thank you so much !!


#12

This really helped. Solved my problem. Thanks a lot!