Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parcel Build Fails on Heroku due to node-sass #2572

Closed
JakeCooper opened this issue Jan 24, 2019 · 4 comments
Closed

Parcel Build Fails on Heroku due to node-sass #2572

JakeCooper opened this issue Jan 24, 2019 · 4 comments

Comments

@JakeCooper
Copy link

馃悰 bug report

Parcel build errors out with the following error when building:

  > DarklaunchDashboard@1.0.0 postinstall /tmp/build_3d19bc047aa04fb3d2678d15f504bef7
  > npm run build
       
       
  > DarklaunchDashboard@1.0.0 build /tmp/build_3d19bc047aa04fb3d2678d15f504bef7
  > parcel build ./client/index.html
       
  lscpu: failed to determine number of CPUs: /sys/devices/system/cpu/possible: No such file or directory

After updating the heroku env variable to PARCEL_WORKERS=1, build hangs indefinitely.

馃帥 Configuration (.babelrc, package.json, cli command)

{
  "name": "DarklaunchDashboard",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "build-watch": "parcel watch ./client/index.html",
    "start-watch": "nodemon server/index.js",
    "dev": "concurrently --kill-others \"npm run start-watch\" \"npm run build-watch\"",
    "build": "parcel build ./client/index.html",
    "prod": "npm run build && node server/index.js",
    "start": "node server/index.js",
    "postinstall": "npm run build"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "classnames": "^2.2.6",
    "downloadjs": "^1.4.7",
    "express": "^4.16.3",
    "express-session": "^1.15.6",
    "firebase": "^5.8.0",
    "mobx": "^5.5.0",
    "mobx-react": "^5.2.8",
    "node-sass": "^4.11.0",
    "parcel-bundler": "^1.11.0",
    "pg": "^7.8.0",
    "postcss-modules": "^1.3.2",
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-router-dom": "^4.3.1",
    "socket.io": "^2.1.1",
    "socket.io-client": "^2.1.1",
    "store": "^2.0.12"
  },
  "devDependencies": {
    "@types/auth0-js": "^8.11.8",
    "@types/firebase": "^3.2.1",
    "@types/react": "^16.0.9",
    "@types/react-dom": "^16.0.0",
    "typescript": "^3.0.3"
  }
}

馃 Expected Behavior

It should build.

馃槸 Current Behavior

It doesn't build

馃拋 Possible Solution

It seems to have occurred once my sass modules gained sufficient size. Trying to figure out exactly what it is in the meantime.

馃捇 Code Sample

馃實 Your Environment

Heroku Free Tier

@louh
Copy link

louh commented Jan 25, 2019

Hey there! 馃憢

We had a very similar problem with our project. After a ton of research and debugging, we found that it was related to this issue: #1836 -- in short, when multiple SCSS files import the same file in parallel (e.g. another SCSS file containing shared variables), Parcel will hang indefinitely on Heroku after a certain threshold number of imports. For us, it was on the 8th import.

The solution was to replace node-sass with the sass package. We were already using sass for linting, and node-sass was only used for bundling SCSS with Parcel, so we just removed the node-sass dependency, and it became an easy fix for us. I might suggest trying the same thing in your project to see if that would help.

Unfortunately, there's only a small note about this in the docs. Since I see this come up again and again (e.g. #2430) I think it might be a worthwhile suggestion to the Parcel maintainers to include a deprecation notice for node-sass when it uses it for a build. That way, when builds do hang, there is another clue in the log. The lscpu warning on Heroku is unfortunately a red herring and we also chased that lead unfruitfully.

Hope that helps!

@JakeCooper
Copy link
Author

JakeCooper commented Jan 27, 2019

@louh Thanks a ton man! That sucks to hear, but sounds about right! I've now even hit a point where building locally doesn't work either.

So is there any way to use sass modules? Or are we completely SOL.

@louh
Copy link

louh commented Jan 28, 2019

You can still use sass modules with the sass or dart-sass packages (they are the same).

@JakeCooper JakeCooper changed the title Parcel Build Fails on Heroku Parcel Build Fails on Heroku due to node-sass Jan 29, 2019
@JakeCooper
Copy link
Author

Perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants