-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Postinstall ignore the project specific .npmrc - IMPORTANT FOR CI #565
Comments
Can you say more about your situation? What does your I just tried this out locally with the
When I do this the installation of esbuild never completes, which indicates to me that it's picking up the proxy setting from |
@evanw, the Companies with many CI/CD pipelines do not connect to the public NPM registry. They use either caching proxies or synchronising registries running on their internal infrastructure. They need to prevent an excessive amount of requests to the public registry., which would be against the NPM policy and an access to the NPM registry would be cut for such company. Some companies block access to the public NPM registry on the build machines to prevent such problem. You should adhere to the NPM registry setting in
You could also allow configuring the path to the cache directory, which is hardcoded to @martinoppitz, the postinstaller does not use |
That's only used as a fallback if running npm itself fails. It's meant as a hedge against weird situations where npm is either broken or not installed at all. An example of this is #274, where the
The postinstall does use npm. It's right here, above the code you linked to. This is necessary to get the downloads to work in situations where people have a custom proxy and/or a custom registry configured. This is already picking up settings from
This information is going to be needed to make more progress on this issue. |
it is interessting - because the postinstall consider the For example
Result of
WHY?
|
Thanks for following up. I was able to reproduce this locally using https://verdaccio.org/. It looks like the npm options that esbuild passes are not the cause of this. The reason seems to be that the I'm not sure if this is a bug in npm or if this is by design, but it seems like a bug to me. Here's where false values become empty strings when writing https://github.com/npm/npm-lifecycle/blob/bfb6f73853a222a3f35a1a6651b0756816e2ed87/index.js#L464 And here is where empty strings from environment variables are ignored in the nested https://github.com/npm/cli/blob/48753bbdfdd4ef5986e4cebef8aa0972ea27d13d/lib/config/core.js#L273 Which version of npm are you using? Is it version 6? Does the problem disappear if you use version 7 instead? I can only reproduce this locally using version 6, not version 7. |
Hello @evanw , the solution for this magic behavior is to set a environment variable.
I don't know, why the postinstall ignores the project specific npm config belongs to |
Closing because this is a bug in npm, not in esbuild. It seems like one workaround is to use npm 7 instead of npm 6. |
It would be important that a postinstall consider the project specific configurations.
Inside a CI Pipeline we does not have root privileges - so we only can change the local .npmrc.
But the npm install of OS specific esbuild binary does not use this settings.
The text was updated successfully, but these errors were encountered: