rescript-lang / rescript-compiler

The compiler for ReScript.
https://rescript-lang.org
Other
6.64k stars 441 forks source link

postinstall script fails on Ubuntu if Node is installed as a Snap Package #5334

Open switch-to-gitlab opened 2 years ago

switch-to-gitlab commented 2 years ago

The title is what I think is going on. (To really be sure, I'd have to uninstall node and reinstall it as an apt package, but I'm afraid of doing that to my environment for fear of fouling up my whole node installation.)

That said, I can't install bs-platform on Ubuntu, and node is currently installed as a snap package.

This shows the part of the npm log where it's failing:

49 timing reify:unretire Completed in 0ms
50 timing build:queue Completed in 4ms
51 timing build:link:node_modules/bs-platform Completed in 6ms
52 timing build:link Completed in 6ms
53 info run bs-platform@9.0.2 postinstall node_modules/bs-platform node scripts/install.js
54 info run bs-platform@9.0.2 postinstall { code: 1, signal: null }
55 timing reify:rollback:createSparse Completed in 371ms
56 timing reify:rollback:retireShallow Completed in 0ms
57 timing command:install Completed in 7385ms
58 verbose stack Error: command failed
58 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
58 verbose stack     at ChildProcess.emit (node:events:390:28)
58 verbose stack     at maybeClose (node:internal/child_process:1064:16)
58 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
59 verbose pkgid bs-platform@9.0.2
60 verbose cwd /home/el/workbench/opendar.gitlab.io/public/scripts/rescript-util
61 verbose Linux 5.13.0-21-generic
62 verbose argv "/snap/node/5534/bin/node" "/usr/local/bin/npm" "install" "bs-platform"
63 verbose node v16.13.0
64 verbose npm  v8.1.3

Line 62 is what makes me think this is related to snap packages. I'm sort of just guessing here, but I think it means that the rescript package was written under the assumption that npm would be in /usr/local/bin/npm/.

I ran the same command using docker and it succeeded like so:

docker run --rm --network host -v "$PWD:/app" -w /app node:latest npm i bs-platform

This seems to have worked as a workaround, but I thought I'd let you know, and than you so much for your time on this project!

bobzhang commented 2 years ago

I'm sort of just guessing here, but I think it means that the rescript package was written under the assumption that npm would be in /usr/local/bin/npm/.

We don't have such assumption, but the log is not verbose enough to make meaningful judgement Would be happy to have a look if you have more verbose logs

stale[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.