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

npm config set tarball no longer supported by npm as of npm v9.3.1 #2800

Closed
matthias-heller opened this issue Feb 18, 2023 · 6 comments
Closed

Comments

@matthias-heller
Copy link

matthias-heller commented Feb 18, 2023

npm config set tarball not working anymore

Is there any workaround? We were using the tarball option to prevent the download of the node headers from internet as our environment doesn't have an internet access. Simply passing it to node-gyp doesn't work because a sub dependency which we don't have in our hand need node-gyp

Executed command

  • npm config set tarball "/node/node-headers.tar.gz" --verbose

npm details:

  • node bin location = C:\Program Files\nodejs\node.exe
  • node version = v18.14.1
  • npm local prefix = C:\Users\User
  • npm version = 9.3.1
  • cwd = C:\Users\User
  • HOME = C:\Users\User
  • Run npm config ls -l to show all defaults.

Verbose output:

npm verb cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
npm info using npm@9.3.1
npm info using node@v18.14.1
npm verb title npm config set tarball
npm verb argv "config" "set" "tarball" "" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:C:\Users\User\AppData\Local\npm-cache_logs\2023-02-18T09_38_37_771Z-
npm verb logfile C:\Users\User\AppData\Local\npm-cache_logs\2023-02-18T09_38_37_771Z-debug-0.log
npm info config set "tarball" ""
npm verb stack Error: tarball is not a valid npm option
npm verb stack at Config.set (C:\Program Files\nodejs\node_modules\npm\lib\commands\config.js:158:15)
npm verb stack at Config.exec (C:\Program Files\nodejs\node_modules\npm\lib\commands\config.js:120:22)
npm verb stack at Config.cmdExec (C:\Program Files\nodejs\node_modules\npm\lib\base-command.js:130:17)
npm verb stack at Npm.exec (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:154:20)
npm verb stack at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli.js:134:5)
npm verb cwd C:\Users\User
npm verb Windows_NT 10.0.19044
npm verb node v18.14.1
npm verb npm v9.3.1
npm ERR! tarball is not a valid npm option
npm verb exit 1
npm verb code 1
Usage: npm
(...)

@StefanStojanovic
Copy link
Contributor

Hello, there is a very similar issue to this one #2798. In short, the workaround is to downgrade npm. For more details on what caused this behavior and when it started, please visit the see npm/cli#6126 (comment)

@doteric
Copy link

doteric commented May 8, 2023

Is there any recommended approach to this? Looks like the nodedir option has also been removed as of npm v9.
Previously we were downloading the headers from https://nodejs.org/download/release/${NODE_VERSION}/node-${NODE_VERSION}-headers.tar.gz and changing the npm config setting.

CC @cclauss

@jhested
Copy link

jhested commented May 24, 2023

Not sure what the use case is here, but hopefully this is of some help to others.

I managed to get around the issue when using yarn by doing

npm_config_tarball=node-headers.tar.gz yarn install

@sseuzss
Copy link

sseuzss commented Jun 1, 2023

Try using export GYP_TARBALL=/node/node-headers.tar.gz for workaround it

@SteveMartinUK
Copy link

I had this issue and initially downgraded npm to get the old behaviour to work. The following worked with npm 9.6.7

npm install --tarball=/tmp/node-headers.tgz

@lukekarrys
Copy link
Member

As others have posted, the preferred way to set npm configs is put npm_config_<NAME>=<VALUE> before your command. This has been updated in the docs.

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

No branches or pull requests

8 participants