Using the environment variable NPM_CONFIG_PREFIX does not work if ran inside a bash script via npm-script.
How can the CLI team reproduce the problem? test.sh#!/bin/bash NPM_CONFIG_PREFIX=/tmp/test npm config get prefix npm_config_prefix=/tmp/test npm config get prefixpackage.json
{ "name": "npm-config-test", "scripts": { "test": "./test.sh", "test2": "NPM_CONFIG_PREFIX=/tmp/test npm config get prefix && npm_config_prefix=/tmp/test npm config get prefix", "test3": "NPM_CONFIG_PREFIX=/tmp/test ./test.sh", "test4": "npm_config_prefix=/tmp/test ./test.sh" } }Running
./test.sh
directly works
➜ npm-config-test ./test.sh
/tmp/test
/tmp/test
Running it through an npm script fails
➜ npm-config-test npm test
> npm-config-test@1.0.0 test /home/$USER/npm-config-test
> ./test.sh
/home/$USER/n
/tmp/test
Running directly in an npm script works
➜ npm-config-test npm run test2
> npm-config-test@1.0.0 test2 /home/$USER/npm-config-test
> NPM_CONFIG_PREFIX=/tmp/test npm config get prefix && npm_config_prefix=/tmp/test npm config get prefix
/tmp/test
/tmp/test
Setting the variable uppercase before the script execution fails
➜ npm-config-test npm run test3
> npm-config-test@1.0.0 test3 /home/$USER/npm-config-test
> NPM_CONFIG_PREFIX=/tmp/test ./test.sh
/home/$USER/n
/tmp/test
Setting the variable lowercase before the script execution works
➜ npm-config-test npm run test4
> npm-config-test@1.0.0 test4 /home/$USER/npm-config-test
> npm_config_prefix=/tmp/test ./test.sh
/tmp/test
/tmp/test
supporting information:
npm -v
prints: 3.10.8node -v
prints: v7.0.0npm config get registry
prints: https://registry.npmjs.org/RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4