parcel: Building - lscpu: failed to determine number of CPUs - Heroku
π/π not sure.
My plan was to build my app on heroku and statically serve the dist folder
package.json
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html --no-minify --public-url ./",
"postinstall": "yarn build"
}
Procfile
web: node server.js
server.js
const path = require('path')
const express = require('express')
const logfmt = require('logfmt')
const app = express()
app.use(logfmt.requestLogger())
app.use('/', express.static(path.join(__dirname + '/dist')));
app.listen(Number(process.env.PORT || 5000))
Now Iβm not an expert on heroku so errors like these are not clear to me.
Locally, through heroku CLI everything works.
On heroku looks like that the output folder dist
is not actually created.
I may be doing something wrong on heroku but it could be something related to parcel and CPUs?
As a result I get a 404 on heroku.
Dist
folder here is in the repo hence it works:
https://scrollytelling.herokuapp.com
https://github.com/albinotonnina/scrollytelling
remote: Building dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v1.3.2
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
---> remote: info fsevents@1.1.3: The platform "linux" is incompatible with this module.
---> remote: info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: [4/4] Building fresh packages...
remote: $ yarn build
remote: yarn run v1.3.2
remote: $ parcel build index.html --no-minify --public-url ./
---> remote: β³ Building...
---> remote:
---> remote: lscpu: failed to determine number of CPUs: /sys/devices/system/cpu/possible: No such file or directory
remote: β³ Building index.html...
remote: Done in 0.75s.
remote: Done in 15.74s.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (3 by maintainers)
None of the solutions work.
this is still happening in version 1.9.7 and still fails to create the dist folder
Please reopen. This issue is not fixed.
@gabsinator in the meantime this is being solved, you can set the following in your Heroku config vars:
PARCEL_WORKERS=1
Using Heroku, same problem
Iβm getting a similar error from
zeit/now-cli build
. Could be related.I am getting this error too while deploying a Parcel built app on Heroku. Tried all the above solutions. config var PARCEL_WORKERS is set to 1
lscpu: failed to determine number of CPUs: /sys/devices/system/cpu/possible: No such file or directory
@albinotonnina : How did you fixed your issue? Could you please share your solution? Might work for someone else tooβ¦
In parcel the cpu count would be used to determine the number of workers to spawn for the build. If you still have this problem you can try to set PARCEL_WORKERS environment variable to 2 (worked for me) and the lscpu path will be omitted altogether while deploying on Heroku.
The problem is with
physical-cpu-count
. I can make a pull request to remove that package and use the else branch:Could add that somewhere in there: https://github.com/parcel-bundler/parcel/blob/master/src/WorkerFarm.js#L27