-
Notifications
You must be signed in to change notification settings - Fork 3.4k
"Unknown user/project config" warnings starting in npm 11.2.0 #8153
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
Comments
This also applies to things like NODE_OPTIONS and any options that are set for pnpm or other package managers that use .npmrc |
This comment has been minimized.
This comment has been minimized.
On my end: |
I believe the intention is to stop people from doing exactly that - from abusing npmrc as a way to define non-npm-related environment or configuration variables. |
We have the same warnings with cli and env config: npm run myScript --customVar
Will there be a way to whitelist some keys? |
My understanding is that only things npm uses will be supported. If you want to pass arguments to the script’s command itself, use |
That will pass arguments only to the last command in case the script is defined like: "myScript": "command1 && command2" Is there an easy way to pass parameters to both commands in this case? |
an environment variable, i suppose? |
Why is this viewed as "abuse"? The
@ljharb, your suggestion of a workaround, an environmental variable, is actually the exact case that has been broken without explanation. @wraithgar, since you shipped this change, can you confirm if this is intended behavior? I think if |
The ~/D/s/glob $ npm pkg get config
{
"foo": "hello world"
}
~/D/s/glob $ npm config ls|grep foo
~/D/s/glob $ npm run env|grep foo
npm_package_config_foo=hello world
~/D/s/glob $ npm -v
11.2.0 No warnings. |
These should be unaffected. In |
I am going to pin this issue for now since there may be more folks who are wondering how to address these warnings. I also added a link to the OP to my comment about |
This comment has been minimized.
This comment has been minimized.
@Rudxain npm comes with node and shouldn't be installed separately, and node in the debian repos is broken - if you must use apt, use the nodesource repos. As for that warning, do you have a |
This comment has been minimized.
This comment has been minimized.
/cc @deepak1556 as VS Code uses $ npm -v
npm warn Unknown project config "disturl". This will stop working in the next major version of npm.
npm warn Unknown project config "target". This will stop working in the next major version of npm.
npm warn Unknown project config "ms_build_id". This will stop working in the next major version of npm.
npm warn Unknown project config "runtime". This will stop working in the next major version of npm.
npm warn Unknown project config "build_from_source". This will stop working in the next major version of npm.
npm warn Unknown project config "timeout". This will stop working in the next major version of npm.
11.2.0 If it is actually not you can ignore this comment. Summary of this issue list: The ideal way would be using |
After installing Node&NPM via NVM, the warning is gone. I'll hide my comments |
But this seems to be static, isn't it?! |
~/D/s/scripts $ npm pkg get scripts.argtest
"node ./script.js"
~/D/s/scripts $ npm run argtest -- hello
> [email protected] argtest
> node ./script.js hello
process.argv.slice(2): [ 'hello' ]
~/D/s/scripts $ cat script.js
console.log('process.argv.slice(2):', process.argv.slice(2)); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I am getting this error for some configurations that I thought belong to NPM:
Besides that, what should I do for configurations that are computer-specific or settings that are needed for all projects? We have the above and some other settings in |
Reminder to please read the |
That does absolutely NOT resolve my issue! I am asking about settings that are NOT package-level, but system-level! I don't want to add these configurations to all my package.jsons and have to switch them out when I am running my installs on other machines. |
Ok that works as a local project's |
I guess I have to clarify my use case here and I cannot see any solution to this. Here's how I use custom arguments in one of my NPM scripts:
Running it like As you can see, it's NX workspace, running commands dynamically. As it's a monorepo, I want to avoid to create all my required NPM scripts per project for all my projects I have inside it. This would lead to some huge project.json. Using environment variables is no option, because running with env var like So what do maintainers recommend for such use cases? |
|
Uh oh!
There was an error while loading. Please reload this page.
---Added by npm team---
Summary
When running
npm --version
, npm issues warnings about some custom configuration keys in my.npmrc
. These warnings indicate that the keys will stop working in the next major version of npm.Environment
Steps to Reproduce
Create a
.npmrc
file with the following content:Run the command:
Observe the following warnings:
Expected Behavior
The custom configuration keys should be recognized, or there should be documentation clarifying the correct way to set these options without triggering warnings.
Actual Behavior
The custom keys (
electron_mirror
,electron_custom_dir
, andelectron_builder_binaries_mirror
) are not recognized by npm, resulting in warning messages about their future deprecation.Questions
Additional Context
I am using custom mirror URLs to optimize package and binary downloads. Any guidance or documentation regarding the proper configuration for these settings would be greatly appreciated.
The text was updated successfully, but these errors were encountered: