-
Notifications
You must be signed in to change notification settings - Fork 3.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
[BUG] npm_package_ variables do not work on npm 7 #2609
Comments
Oh, apparently this was covered on the "beta" announcement but not mentioned as far as I can tell on the GA announcement. The link to the actual RFC 21 is also a 404 error. It is also not mentioned at all on the v7 online documentation. |
@robross0606 looks like |
As per RFC21, that is not true. I can confirm this with testing by toggling back and forth between v6 and v7 of NPM. This is not a bug, just a glaring omission in the GA announcement if you weren't tracking the beta announcements. Caught us off guard. I should also point out that the official documentation is still pointing to NPM v6 as "LTS" and stable while NPM v7 is listed as "development" (https://docs.npmjs.com/cli/). This is no longer accurate since the tags for NPM "LTS" have been changed to point to v7.
|
This is also a breaking change for our teams, who have a very similar use case for docker configuration and other dependency config being passed to short shell script commands. Going to a full parsing of the package.json just to get these values is painful. |
Same for our team: we are using npm run scripts that include variables and among other things deploy to test and production. |
@robross0606 apologize for the confusion here. We did modify/remove many environment variables (re. https://github.com/npm/rfcs/blob/latest/implemented/0021-reduce-lifecycle-script-environment.md); Also, our docs are slightly stale because of a build failure - this should be resolved by early next week. The latest/greatest CLI docs are in the repo/CLI itself (ex. |
@darcyclarke Can you confirm that we can work around this change by moving our values under the |
@markmsmith we shouldn't be removing any other env vars from the existing scope of what was documented in that RFC to my knowledge. We've actually only ever agreed to continue supporting more; That said, the entire point is to limit the scope of config we're passing along through/too lifecycle events - if |
This is a significant breaking change not mentioned in the NPM 8 GA breaking changes. Other |
@amclin it was a documented breaking change in npm v7 with a corresponding RFC where it was thoroughly discussed; this is why there isn't a reference to it in v8's changelog. |
@darcyclarke, please re-post the link to the release changelog where this is covered because your link is dead. I came back to look and it is still not covered anywhere in the published release changelogs for npm 7, 8 or 9. AFAICT, it is still only buried in the RFC and in some pre-release notes. |
Since the upgrade to npm v7, no
npm_package_
variables work.Current Behavior:
Using npm 7, npm scripts cannot access anything other than the following fields:
With npm v6, other variables were exposed. For example, if we had a section like this:
this is exposed in npm 6 as
$npm_package_dockerConfig_imageRepo
. This no longer works with v7 at all.Expected Behavior:
$npm_package_
variables should be exposed as described in documentation.Steps To Reproduce:
npm run env
. Note existence of custom available variables.npm run env
. Note all custom variables are missing.Environment:
The text was updated successfully, but these errors were encountered: