parcel: Could not resolve module @parcel/css/parcel-css.linux-x64-musl.node
π bug report
Building...
π¨ Build failed.
@parcel/transformer-css: Could not resolve module
"/home/node/application/node_modules/@parcel/css/parcel-css.linux-x64-musl.node"
from "/home/node/application/node_modules/@parcel/css/node/index.js"
π Configuration (.babelrc, package.json, cli command)
CLI command:
$ parcel index.html
π€ Expected Behavior
The build should succeed.
π― Current Behavior
When running the command inside Docker:
$ parcel index.html
I get the following error:
Error: Could not resolve module
"/home/node/application/node_modules/@parcel/css/parcel-css.linux-x64-musl.node"
from "/home/node/application/node_modules/@parcel/css/node/index.js"
at $0578d0f6e116167e$export$fb2a0b866a8162dc.resolve
(/home/node/application/node_modules/@parcel/package-manager/lib/index.js:4919:21)
at NodePackageManager.resolveSync
(/home/node/application/node_modules/@parcel/package-manager/lib/index.js:3510:42)
at NodePackageManager.requireSync
(/home/node/application/node_modules/@parcel/package-manager/lib/index.js:3351:34)
at Module.m.require
(/home/node/application/node_modules/@parcel/package-manager/lib/index.js:3365:25)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous>
(/home/node/application/node_modules/@parcel/css/node/index.js:21:22)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at NodePackageManager.load
(/home/node/application/node_modules/@parcel/package-manager/lib/index.js:3374:15)
π Possible Solution
No idea.
π¦ Context
I am running everything here inside a fermium-alpine
Docker environment,
although the same happens in a node:gallium-alpine
environment.
I started seeing the issue about a week ago, maybe a little less, There is also a Pull Request available with everything at latest here.
π» Code Sample
The full codebase can be seen at small-glade.
You can just run docker-compose up
.
π Your Environment
A node:gallium-alpine
Docker environment.
Software | Version(s) |
---|---|
Parcel | 2.4.0 |
Node | 14.19.1 |
npm/Yarn | npm 6.14.16 |
Operating System | Alpine |
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
Commits related to this issue
- fix: install optional dependencies inside container https://github.com/parcel-bundler/parcel/issues/7962 — committed to hvolschenk/small-glade by hvolschenk 2 years ago
- Workaround https://github.com/parcel-bundler/parcel/issues/7962 — committed to BotTech/storypark-image-grabber by steinybot 2 years ago
I encountered this issue as well.
Simply running
npm install --save-dev @parcel/css
fixed the issue in the CI pipeline.Hey @afitzgerald, I think that @devongovett is correct here.
My situation is maybe a bit strange. Like I said, the steps I followed to get to this issue are:
package.json
andpackage-lock.json
into an Alpine container (source).Thus the lock-file says that
@parcel/transformer-css
is not required as it was generated on MacOS but then I am installing dependencies on Alpine which does require@parcel/transformer-css
.The weirdness here is that it worked a week or two ago and now doesnβt and I cannot quite pinpoint what updated to cause this change. I initially thought it was something that
parcel
changed, but I am now doubting that.Okay π Thanks to your replies I have managed to find the issue.
Inside the container I was running
npm install --no-optional
. I changed it tonpm install
which has now resolved the issue.I am thinking that because the
package-lock.json
file is generated outside of the container that the dependency mentioned above is optional, and then got skipped while building the container.I am still unsure of what exactly changed, as this had been working for months before, but I guess that isnβt important now.
Thank you for your time.
When I run
npm install @parcel/css
, I see the packages for all platforms listed in package-lock.json. What version of npm are you using?I donβt believe that requiring the removal of --no-optional should be the solution for this. Parcel should call out @parcel/transformer-css as a required dependency.