Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post-install "install.js" failing #1973

Closed
kgmmm opened this issue Jan 29, 2022 · 11 comments
Closed

Post-install "install.js" failing #1973

kgmmm opened this issue Jan 29, 2022 · 11 comments

Comments

@kgmmm
Copy link

kgmmm commented Jan 29, 2022

Ubuntu 20.04.1.

Running npm install after a fresh SvelteKit init. Trying to install esbuild globally throws the same error.

~/new-app$ npm install
npm ERR! code 1
npm ERR! path /home/user/new-app/node_modules/esbuild
npm ERR! command failed
npm ERR! command sh -c node install.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2022-01-29T10_59_50_034Z-debug-0.log

End of the log file

399 info run esbuild@0.13.15 postinstall node_modules/esbuild node install.js
400 info run esbuild@0.13.15 postinstall { code: 1, signal: null }
401 timing reify:rollback:createSparse Completed in 134ms
402 timing reify:rollback:retireShallow Completed in 0ms
403 timing command:install Completed in 14611ms
404 verbose stack Error: command failed
404 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
404 verbose stack     at ChildProcess.emit (node:events:390:28)
404 verbose stack     at maybeClose (node:internal/child_process:1064:16)
404 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
405 verbose pkgid esbuild@0.13.15
406 verbose cwd /home/user/new-app
407 verbose Linux 5.13.0-27-generic
408 verbose argv "/snap/node/5770/bin/node" "/usr/local/bin/npm" "install"
409 verbose node v16.13.2
410 verbose npm  v8.3.2
411 error code 1
412 error path /home/user/new-app/node_modules/esbuild
413 error command failed
414 error command sh -c node install.js
415 verbose exit 1
416 timing npm Completed in 14831ms
417 verbose unfinished npm timer reify 1643453990251
418 verbose unfinished npm timer reify:build 1643454004551
419 verbose unfinished npm timer build 1643454004552
420 verbose unfinished npm timer build:deps 1643454004552
421 verbose unfinished npm timer build:run:postinstall 1643454004558
422 verbose unfinished npm timer build:run:postinstall:node_modules/esbuild 1643454004559
423 verbose code 1
424 error A complete log of this run can be found in:
424 error     /home/user/.npm/_logs/2022-01-29T10_59_50_034Z-debug-0.log
@evanw
Copy link
Owner

evanw commented Jan 29, 2022

I assume from your description that the reproduction steps are to follow https://kit.svelte.dev/docs#introduction-getting-started. I can't reproduce this in my Ubuntu VM (Ubuntu 21.10):

$ npm init svelte@next my-app
Need to install the following packages:
  create-svelte@next
Ok to proceed? (y) y

create-svelte version 2.0.0-next.113

Welcome to SvelteKit!

This is beta software; expect bugs and missing features.

Problems? Open an issue on https://github.com/sveltejs/kit/issues if none exists already.

✔ Which Svelte app template? › SvelteKit demo app
✔ Use TypeScript? … No / Yes
✔ Add ESLint for code linting? … No / Yes
✔ Add Prettier for code formatting? … No / Yes

Your project is ready!

Install community-maintained integrations:
  https://github.com/svelte-add/svelte-adders

Next steps:
  1: cd my-app
  2: npm install (or pnpm install, etc)
  3: git init && git add -A && git commit -m "Initial commit" (optional)
  4: npm run dev -- --open

To close the dev server, hit Ctrl-C

Stuck? Visit us at https://svelte.dev/chat

$ cd my-app/
$ npm install

added 40 packages, and audited 41 packages in 10s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

As you can see it works fine for me. So I'm marking this as unactionable because there isn't realistically anything I can do about this since I can't reproduce it. However, you can help out by debugging this yourself. Here are instructions: #1711 (comment)

@kgmmm
Copy link
Author

kgmmm commented Jan 30, 2022

Hi I tried my hand at debugging this, after testing different versions of node I found that updating to v17.4.0 seems to have fixed this issue for me. After updating node to v17.4.0 I was able to install esbuild using npm globally.

Edit: even though it says in the log file, thought it would be correct to mention I was previously using node v16.13.2

@evanw
Copy link
Owner

evanw commented Jan 30, 2022

Were you able to figure out anything about the failure? How far does the install script get before it fails, and what causes the failure?

@kgmmm
Copy link
Author

kgmmm commented Jan 30, 2022

No sorry, was not been able to make any meaningful progress.

@fikus88
Copy link

fikus88 commented Jan 31, 2022

Hi I tried my hand at debugging this, after testing different versions of node I found that updating to v17.4.0 seems to have fixed this issue for me. After updating node to v17.4.0 I was able to install esbuild using npm globally.

Edit: even though it says in the log file, thought it would be correct to mention I was previously using node v16.13.2

I can confirm that updating node to 17.4 fixed this issue for me too.

@evanw
Copy link
Owner

evanw commented Feb 2, 2022

I was finally able to reproduce this issue by installing node via snap (more info in #1711) and I pushed out a fix in version 0.14.17. Does the latest esbuild release fix these installation issues for you?

@kgmmm
Copy link
Author

kgmmm commented Feb 2, 2022

Hi using node v16.13.2 via Snap and trying to install esbuild@0.14.17 and gives me the same error as before...

~/my-app$ npm i esbuild@0.14.17
npm ERR! code 1
npm ERR! path /home/user/my-app/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild
npm ERR! command failed
npm ERR! command sh -c node install.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2022-02-02T09_48_41_434Z-debug-0.log

Tail end of the Log File

745 timing build:link:node_modules/esbuild Completed in 4ms
746 timing build:link:node_modules/nanoid Completed in 4ms
747 timing build:link:node_modules/prettier Completed in 4ms
748 timing build:link:node_modules/rollup Completed in 4ms
749 timing build:link:node_modules/vite Completed in 4ms
750 timing build:link:node_modules/resolve Completed in 4ms
751 timing build:link Completed in 5ms
752 info run esbuild@0.14.17 postinstall node_modules/esbuild node install.js
753 info run esbuild@0.13.15 postinstall node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild node install.js
754 info run esbuild@0.13.15 postinstall node_modules/@sveltejs/adapter-netlify/node_modules/esbuild node install.js
755 info run esbuild@0.13.15 postinstall node_modules/@sveltejs/adapter-vercel/node_modules/esbuild node install.js
756 info run esbuild@0.13.15 postinstall node_modules/vite/node_modules/esbuild node install.js
757 info run esbuild@0.14.17 postinstall { code: 0, signal: null }
758 timing build:run:postinstall:node_modules/esbuild Completed in 203ms
759 info run esbuild@0.13.15 postinstall { code: 1, signal: null }
760 info run esbuild@0.13.15 postinstall { code: 1, signal: null }
761 info run esbuild@0.13.15 postinstall { code: 1, signal: null }
762 info run esbuild@0.13.15 postinstall { code: 1, signal: null }
763 timing reify:rollback:createSparse Completed in 331ms
764 timing reify:rollback:retireShallow Completed in 0ms
765 timing command:i Completed in 2254ms
766 verbose stack Error: command failed
766 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
766 verbose stack     at ChildProcess.emit (node:events:390:28)
766 verbose stack     at maybeClose (node:internal/child_process:1064:16)
766 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
767 verbose pkgid esbuild@0.13.15
768 verbose cwd /home/user/my-app
769 verbose Linux 5.13.0-28-generic
770 verbose argv "/snap/node/5770/bin/node" "/usr/local/bin/npm" "i" "esbuild@0.14.17"
771 verbose node v16.13.2
772 verbose npm  v8.3.2
773 error code 1
774 error path /home/user/my-app/node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild
775 error command failed
776 error command sh -c node install.js
777 verbose exit 1
778 timing npm Completed in 2477ms
779 verbose unfinished npm timer reify 1643795321656
780 verbose unfinished npm timer reify:build 1643795323289
781 verbose unfinished npm timer build 1643795323289
782 verbose unfinished npm timer build:deps 1643795323289
783 verbose unfinished npm timer build:run:postinstall 1643795323299
784 verbose unfinished npm timer build:run:postinstall:node_modules/@sveltejs/adapter-cloudflare/node_modules/esbuild 1643795323316
785 verbose unfinished npm timer build:run:postinstall:node_modules/@sveltejs/adapter-netlify/node_modules/esbuild 1643795323332
786 verbose unfinished npm timer build:run:postinstall:node_modules/@sveltejs/adapter-vercel/node_modules/esbuild 1643795323348
787 verbose unfinished npm timer build:run:postinstall:node_modules/vite/node_modules/esbuild 1643795323364
788 verbose code 1
789 error A complete log of this run can be found in:
789 error     /home/user/.npm/_logs/2022-02-02T09_48_41_434Z-debug-0.log

@evanw
Copy link
Owner

evanw commented Feb 2, 2022

Shoot. Thanks for checking. My change definitely did fix an issue for me so I guess there were multiple separate issues.

@evanw
Copy link
Owner

evanw commented Feb 2, 2022

Wait. That log is saying that esbuild@0.14.17 succeeded. The thing that failed is esbuild@0.13.15. You're still installing the old version of esbuild that has this issue, but it looks like the issue was fixed in this latest release:

757 info run esbuild@0.14.17 postinstall { code: 0, signal: null }
759 info run esbuild@0.13.15 postinstall { code: 1, signal: null }

So you just need to somehow make sure you aren't installing esbuild < 0.14.17. Maybe one of your dependencies needs to update their esbuild version too?

Closing as fixed on esbuild's end.

@evanw evanw closed this as completed Feb 2, 2022
@kgmmm
Copy link
Author

kgmmm commented Feb 2, 2022

Good catch! Just double checked this. Using node v16.13.2 via Snap and installing esbuild@0.13.15 failed. Using node v16.13.2 via Snap and installing esbuild@0.14.17 did indeed work. The conflict I was having came about from trying to do a SvelteKit init before hand, and then typing npm i esbuild@0.14.17, which was causing npm to install both esbuild@0.14.17 (which would succeed) and esbuild@0.13.15 (which would fail).

@aral
Copy link

aral commented Feb 27, 2024

In case it helps anyone else who stumbles on here, you will also see this exact same message if you somehow have npm installed but not node.

e.g., In my case, I was testing on a Windows machine under WSL2 where node was installed under Windows but not under the WSL2 Linux VM but the VM could still find npm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants