-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
In our package.json we have an array of values that we access via environment variables in our npm scripts. Example:
"scripts": {
"echo": "echo $npm_package_config_foo $npm_package_config_bar"
},
"config": {
"foo": [
"a",
"b",
"c"
],
"bar": "d e f"
},
Under 10.4 and 10.5, the $npm_package_config_foo
variable is either empty, or isn't defined.
➜ /workspace git:(main) ✗ npm run echo
> [email protected] echo
> echo $npm_package_config_foo $npm_package_config_bar
d e f
➜ /workspace git:(main) ✗ npm --version
10.5.0
Expected Behavior
Under npm 10.2 and 10.3, arrays would be concatenated into a space separated list.
Running npm run echo
outputs:
➜ /workspace git:(main) ✗ npm run echo
> [email protected] echo
> echo $npm_package_config_foo $npm_package_config_bar
a b c d e f
➜ /workspace git:(main) ✗ npm --version
10.2.4
Steps To Reproduce
I have created a codesandbox with an example. https://codesandbox.io/p/devbox/dnkx8d
Running nvm i 18.19
will get you npm 10.2.4, and nvm i 18.20
will get you npm 10.5.0.
In my local debugging I confirmed the change was between 10.3 and 10.4.
Environment
- npm: 10.5.0
- Node.js: 18.20.1
- OS Name: Linux and macOS
- System Model Name: Macbook Pro M1, and in codesandbox
- npm config:
; "env" config from environment
cache = "/root/.cache/npm"
store-dir = "/root/.cache/pnpm"
; node bin location = /usr/local/share/nvm/versions/node/v18.20.1/bin/node
; node version = v18.20.1
; npm local prefix = /workspace
; npm version = 10.5.0
; cwd = /workspace
; HOME = /root
; Run `npm config ls -l` to show all defaults.