rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

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

Open switch-to-gitlab opened this issue 4 years ago • 2 comments

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 [email protected] postinstall node_modules/bs-platform node scripts/install.js
54 info run [email protected] 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 [email protected]
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!

switch-to-gitlab avatar Nov 14 '21 17:11 switch-to-gitlab

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

bobzhang avatar Dec 04 '21 03:12 bobzhang

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.

stale[bot] avatar Mar 13 '24 08:03 stale[bot]