Closed kirrg001 closed 6 months ago
Did you run npm install --save-dev prebuildify node-gyp prebuildify-cross
?
The Error: canceled
error comes from https://github.com/npm/cli/blob/v8.19.2/workspaces/libnpmexec/lib/index.js#L230 and got an improved message in a later version of npm: https://github.com/npm/cli/commit/02c7ddb4501682c9e84b8c1325638b7db1ca7deb. It indicates that dependencies are missing.
I installed the dependencies you have mentioned in the root of my lerna project and in the package itself. Both does not work. The problem is that npm workspaces installs them on the root node_modules folder. I guess that's why a dependency cannot be found.
I see. Yeah, that scenario is not supported by prebuildify-cross
. It can only mount one node_modules
folder in the Docker container, and expects all dependencies to be there.
Would you accept a pull request? I can take a look
What solution do you suggest?
I would add a second volume which overrides the node_modules folder.
const child = dockerRun(image, {
entrypoint: 'node',
argv: ['-'].concat(argv),
remove: false,
volumes: {
// Should but can't use :ro (mafintosh/docker-run#12)
[cygwin(cwd)]: '/input',
[path.join(cwd, '..', '..', 'node_modules')]: '/input/node_modules'
},
env: {
PREBUILDIFY_CROSS_FILES: files,
// Disable npm update check
NO_UPDATE_NOTIFIER: 'true'
}
})
If you pass an argv argument e.g. --node-modules-path /absolute/path/to/node_modules
we will add the second volume, otherwise by default there is only one volume.
Sounds good! PR welcome.
Hi there!
I am running into an error. I have tried different images and different node versions.
First of all, it was really hard to get the npm log file out of the docker container. I had to add
remove: false
to thedockerRun
command.This is the npm log from the container:
The log file is not really helpful. I don't know why it's failing. It looks to me that the
prebuildify
command in the container is failing but I don't know why. Any help would be appreciated :)I am able to generate prebuilds with latest version of
prebuildify
on my macbook without any issues.$ node -v v18.14.2
$ npx prebuildify-cross 5.0.0
Darwin x64
Thank you!