sanathkr / go-npm

Distribute and install Go binaries via NPM
Apache License 2.0
171 stars 56 forks source link

non-global install fails #19

Open thenbe opened 1 year ago

thenbe commented 1 year ago

In this example, I'm using @go-task/cli as an example. If this issue belongs elsewhere please let me know. Thanks!

Using npm, npm install exits with error. See log below.

Using pnpm, pnpm install command exits successfully, whereas it should exit with error because the binary does not get installed.

Repro: https://github.com/thenbe/repro-task-local

System info

$  nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.26, NixOS, 23.05 (Stoat), 23.05pre480050.1a411f23ba2`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - channels(root): `"nixos, nixos-unstable"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Log (npm install) ```log 0 verbose cli /nix/store/liwmv8n976qnm2vv55nnqpwmjzfnswi7-nodejs-18.16.0/bin/node /run/current-system/sw/bin/npm 1 info using npm@9.5.1 2 info using node@v18.16.0 3 timing npm:load:whichnode Completed in 1ms 4 timing config:load:defaults Completed in 0ms 5 timing config:load:file:/nix/store/liwmv8n976qnm2vv55nnqpwmjzfnswi7-nodejs-18.16.0/lib/node_modules/npm/npmrc Completed in 1ms 6 timing config:load:builtin Completed in 1ms 7 timing config:load:cli Completed in 0ms 8 timing config:load:env Completed in 1ms 9 timing config:load:file:/home/nbe/projects/playground/task-repro/repro-task-non-monorepo/.npmrc Completed in 0ms 10 timing config:load:project Completed in 0ms 11 timing config:load:file:/home/nbe/.npmrc Completed in 0ms 12 timing config:load:user Completed in 0ms 13 timing config:load:file:/nix/store/liwmv8n976qnm2vv55nnqpwmjzfnswi7-nodejs-18.16.0/etc/npmrc Completed in 1ms 14 timing config:load:global Completed in 1ms 15 timing config:load:setEnvs Completed in 0ms 16 timing config:load Completed in 3ms 17 timing npm:load:configload Completed in 3ms 18 timing npm:load:mkdirpcache Completed in 0ms 19 timing npm:load:mkdirplogs Completed in 0ms 20 verbose title npm install 21 verbose argv "install" 22 timing npm:load:setTitle Completed in 1ms 23 timing config:load:flatten Completed in 1ms 24 timing npm:load:display Completed in 1ms 25 verbose logfile logs-max:10 dir:/home/nbe/.npm/_logs/2023-05-05T19_07_39_220Z- 26 verbose logfile /home/nbe/.npm/_logs/2023-05-05T19_07_39_220Z-debug-0.log 27 timing npm:load:logFile Completed in 2ms 28 timing npm:load:timers Completed in 0ms 29 timing npm:load:configScope Completed in 0ms 30 timing npm:load Completed in 8ms 31 timing arborist:ctor Completed in 0ms 32 silly logfile start cleaning logs, removing 2 files 33 silly logfile done cleaning log files 34 timing arborist:ctor Completed in 0ms 35 timing idealTree:init Completed in 6ms 36 timing idealTree:userRequests Completed in 0ms 37 silly idealTree buildDeps 38 silly fetch manifest @go-task/cli@3.24.0 39 http fetch GET 200 https://registry.npmjs.org/@go-task%2fcli 2501ms (cache miss) 40 silly placeDep ROOT @go-task/cli@3.24.0 OK for: repro-task-non-monorepo@1.0.0 want: 3.24.0 41 silly fetch manifest @go-task/go-npm@^0.1.17 42 http fetch GET 200 https://registry.npmjs.org/@go-task%2fgo-npm 322ms (cache miss) 43 timing idealTree:#root Completed in 2833ms 44 silly placeDep ROOT @go-task/go-npm@0.1.17 OK for: @go-task/cli@3.24.0 want: ^0.1.17 45 timing idealTree:node_modules/@go-task/cli Completed in 7ms 46 timing idealTree:node_modules/@go-task/go-npm Completed in 0ms 47 timing idealTree:buildDeps Completed in 2841ms 48 timing idealTree:fixDepFlags Completed in 1ms 49 timing idealTree Completed in 2848ms 50 timing reify:loadTrees Completed in 2849ms 51 timing reify:diffTrees Completed in 1ms 52 silly reify moves {} 53 timing reify:retireShallow Completed in 1ms 54 timing reify:createSparse Completed in 1ms 55 timing reify:loadBundles Completed in 0ms 56 silly audit bulk request { '@go-task/cli': [ '3.24.0' ], '@go-task/go-npm': [ '0.1.17' ] } 57 silly tarball no local data for @go-task/go-npm@https://registry.npmjs.org/@go-task/go-npm/-/go-npm-0.1.17.tgz. Extracting by manifest. 58 silly tarball no local data for @go-task/cli@https://registry.npmjs.org/@go-task/cli/-/cli-3.24.0.tgz. Extracting by manifest. 59 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 1181ms 60 timing auditReport:getReport Completed in 1183ms 61 silly audit report {} 62 timing auditReport:init Completed in 0ms 63 timing reify:audit Completed in 1185ms 64 http fetch GET 200 https://registry.npmjs.org/@go-task/cli/-/cli-3.24.0.tgz 1543ms (cache miss) 65 timing reifyNode:node_modules/@go-task/cli Completed in 1547ms 66 http fetch GET 200 https://registry.npmjs.org/@go-task/go-npm/-/go-npm-0.1.17.tgz 3328ms (cache miss) 67 timing reifyNode:node_modules/@go-task/go-npm Completed in 3331ms 68 timing reify:unpack Completed in 3331ms 69 timing reify:unretire Completed in 0ms 70 timing build:queue Completed in 1ms 71 timing build:link:node_modules/@go-task/go-npm Completed in 1ms 72 timing build:link Completed in 1ms 73 info run @go-task/cli@3.24.0 postinstall node_modules/@go-task/cli go-npm install 74 info run @go-task/cli@3.24.0 postinstall { code: 1, signal: null } 75 timing reify:rollback:createSparse Completed in 2ms 76 timing reify:rollback:retireShallow Completed in 0ms 77 timing command:install Completed in 8448ms 78 verbose stack Error: command failed 78 verbose stack at ChildProcess. (/nix/store/liwmv8n976qnm2vv55nnqpwmjzfnswi7-nodejs-18.16.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) 78 verbose stack at ChildProcess.emit (node:events:513:28) 78 verbose stack at maybeClose (node:internal/child_process:1091:16) 78 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:302:5) 79 verbose pkgid @go-task/cli@3.24.0 80 verbose cwd /home/nbe/projects/playground/task-repro/repro-task-non-monorepo 81 verbose Linux 6.1.26 82 verbose node v18.16.0 83 verbose npm v9.5.1 84 error code 1 85 error path /home/nbe/projects/playground/task-repro/repro-task-non-monorepo/node_modules/@go-task/cli 86 error command failed 87 error command sh -c go-npm install 88 error Downloading from URL: https://github.com/go-task/task/releases/download/v3.24.0/task_linux_amd64.tar.gz 89 error node:internal/fs/utils:347 89 error throw err; 89 error ^ 89 error 89 error Error: EROFS: read-only file system, copyfile 'bin/task' -> '/nix/store/liwmv8n976qnm2vv55nnqpwmjzfnswi7-nodejs-18.16.0/bin/task' 89 error at copyFileSync (node:fs:2894:3) 89 error at /home/nbe/projects/playground/task-repro/repro-task-non-monorepo/node_modules/@go-task/go-npm/bin/index.js:2:912957 89 error at /home/nbe/projects/playground/task-repro/repro-task-non-monorepo/node_modules/@go-task/go-npm/bin/index.js:2:910247 89 error at ChildProcess.exithandler (node:child_process:427:5) 89 error at ChildProcess.emit (node:events:513:28) 89 error at maybeClose (node:internal/child_process:1091:16) 89 error at ChildProcess._handle.onexit (node:internal/child_process:302:5) { 89 error errno: -30, 89 error syscall: 'copyfile', 89 error code: 'EROFS', 89 error path: 'bin/task', 89 error dest: '/nix/store/liwmv8n976qnm2vv55nnqpwmjzfnswi7-nodejs-18.16.0/bin/task' 89 error } 89 error 89 error Node.js v18.16.0 90 verbose exit 1 91 timing npm Completed in 8465ms 92 verbose unfinished npm timer reify 1683313659237 93 verbose unfinished npm timer reify:build 1683313665426 94 verbose unfinished npm timer build 1683313665426 95 verbose unfinished npm timer build:deps 1683313665426 96 verbose unfinished npm timer build:run:postinstall 1683313665428 97 verbose unfinished npm timer build:run:postinstall:node_modules/@go-task/cli 1683313665428 98 verbose code 1 99 error A complete log of this run can be found in: 99 error /home/nbe/.npm/_logs/2023-05-05T19_07_39_220Z-debug-0.log ```

FWIW, this used to work up until a month ago or so. I have an old repo on my system where the binary is correctly installed using pnpm. But re-running pnpm install in that repo does not install the binary correctly anymore. Many variables might have caused this to change, but the most likely could be node version or pnpm version.