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

Install script uses wrong registry #1485

Closed
sschneider-ihre-pvs opened this issue Aug 1, 2021 · 8 comments · Fixed by #1621
Closed

Install script uses wrong registry #1485

sschneider-ihre-pvs opened this issue Aug 1, 2021 · 8 comments · Fixed by #1621

Comments

@sschneider-ihre-pvs
Copy link

I tried a fresh vite project which has esbuild as dep. When I try to run npm install i see that the install script is trying to download something from a different registry than npm is configured with.
Is there a way to override the url from the install.js so it is asking the correct registry for the package?

npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm ERR! Trying to install "esbuild-windows-64" using npm
npm ERR! Failed to install "esbuild-windows-64" using npm: Command failed: npm install --loglevel=error --prefer-offline --no-audit --progress=false esbuild-windows-64@0.12.17
npm ERR! npm ERR! code ETARGET
npm ERR! npm ERR! notarget No matching version found for esbuild-windows-64@0.12.17.
npm ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! npm ERR! notarget a package version that doesn't exist.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\<user>\AppData\Local\npm-cache\_logs\2021-08-01T20_58_36_415Z-debug.log
npm ERR!
npm ERR! Trying to download "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.12.17.tgz"
npm ERR! Failed to download "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.12.17.tgz": connect ETIMEDOUT
@evanw
Copy link
Owner

evanw commented Aug 1, 2021

It's supposed to pick up the registry setting from npm's configuration. See #1193 (comment). It sounds like Yarn has bugs with nested npm invocations picking up the correct configuration, as does npm. But this isn't a problem with esbuild (esbuild is just running the npm command). This is a problem with npm (or whatever package manager you have substituted for npm if applicable).

In case you're wondering, the reason why you're seeing the download from registry.npmjs.org in the logs is that the npm install has already failed and the esbuild installer is trying again with registry.npmjs.org just in case that works. But the issue is with the failed npm install.

I'm working on an alternate installation strategy that doesn't use a postinstall script. Hopefully this approach would work around these issues. You can follow along here for updates: #789.

@dan-nl
Copy link

dan-nl commented Aug 4, 2021

@sschneider-ihre-pvs, npm i -D esbuild@0.12.16 vite took care of the issue for the moment; tested this locally and in a pipeline.

@sschneider-ihre-pvs
Copy link
Author

that sounds promising

@michaelfaith
Copy link

This is affecting us now too. Angular v12 application builds are failing corporate-wide because esbuild is trying to install something from the yarn registry instead of our internal artifact store. If installing an older version of esbuild fixes it, then it seems like this is a regression issue and not just some bug with npm/yarn.

@woppa684
Copy link

A possible cause for this is mentioned in the linked issue above. I would also like to see a solution here indeed. Maybe not doing a cwd would already fix it?

@evanw
Copy link
Owner

evanw commented Aug 12, 2021

Do you have a self-contained way to reproduce this issue? Then we could figure out if there's a configuration issue and/or which piece of software needs to be fixed.

@michaelfaith
Copy link

That's going to be tricky without being behind some kind of firewall. We did find something that helped with this, in case it points towards a root cause. We were still having issues (but with a slightly different error) after rolling back to 0.12.6. Our build boxes didn't have yarnrc files on them, just npmrc, which has worked fine for us til now, since yarn falls back on that. After also explicitly setting the registry in a yarnrc to our registry, the esbuild postinstall went through. But still with the older version.

But even that doesn't really help @woppa684's issue though, with project level npmrc files not being picked up

@michaelfaith
Copy link

I'll retry in the morning with the newer version and that setup.

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

Successfully merging a pull request may close this issue.

5 participants