nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.47k stars 282 forks source link

from version nodejs 15 I get an error: Error: double-loading config .. .npmrc" as "user", previously loaded as "project" #4193

Closed kad-meedel closed 1 year ago

kad-meedel commented 1 year ago

Details

When I want to use nodejs version 15 or higher I get the following error when trying to do a npm install xxx or even a npm config list.

The error I get is:

Error: double-loading config "/var/jenkins_data/workspace/test-scripts_test-nodejs-19/.npmrc" as "user", previously loaded as "project" My 'default' .npmrc file is in the home dir of the user. So I overwrite some settings within the project npmrc

Node.js version

The problem shows up from nodejs 15 and higher

Example code

No response

Operating system

jenkins environment within linux server

Scope

install packages

Module and version

From nodejs 15 and higher

Gloriouspete commented 1 year ago

You seem to be having a configuration conflict with the npmrc file, A helpful solution would be to reset Npm with npm config delete userconfig and then install it back ,

we're also using node 18 currently so i'd advice you upgrade to node 18, sometimes old versions causes these issues,

if all these still doesn't work, use npm cache clean --force to clear unnecessary cache that may be causing conflict.

Good luck.

kad-meedel commented 1 year ago

Gloriouspete, thanks for your quick reply. I wil try you suggestions.

Thanks

Gloriouspete commented 1 year ago

You're welcome, I'd be expecting feedback

kad-meedel commented 1 year ago

I changed my setting NPM_CONFIG_USERCONFIG to NODE_CONFIG_DIR For my tests it wil be ok. The errors are gone

preveen-stack commented 1 year ago

@kad-meedel If your issue is solved, would you mind closing the issue

Gloriouspete commented 1 year ago

Use .npmrc.development then you can load it like that in your env.

But the issue is caused because you have the same npmrc file in both user and project

joemdjossou commented 1 year ago

I got this kind of error but instead of <<as "user", previously loaded as "project">> It is as as \.cache\firebase\runtime\npmrc" as "global", previously loaded as "user"

I was trying to run the binary for the Firebase CLI in order to list my Firebase projects but when I enter any command under npm it flashes the error stated above. @Gloriouspete can you help me figure it out?

Gloriouspete commented 1 year ago

@joemdjossou have you tried npm cache clean , also what version of node are you using

joemdjossou commented 1 year ago

I'm using the node veersion 18.17.1 I tried it but it has given me an error I then tried npm cache clean --force

This was the answer npm WARN using --force Recommended protections disabled

But still getting under binary for the Firebase CLI .cache\firebase\runtime\npmrc" as "global", previously loaded as "user" @Gloriouspete

Gloriouspete commented 1 year ago

Try verifying your installation steps .

An easy way would be to uninstall firebase-cli

Use npm uninstall -g firebase-tools to uninstall then install again correctly implementing the installation steps. It should fix it

joemdjossou commented 1 year ago

Ok I will try to uninstall every npm packages node.js and firebase-cli and then Refollow the steps one by one I'll send you a feedback about it

welligtonporto commented 1 year ago

I updated the nodejs to the last version (18.17.1) and the firebase-tools npm install -g firebase-tools and fix it.

joemdjossou commented 1 year ago

It is finally working guys Thank y'all :)

mhjb commented 1 year ago

removing the version of firebase cli that I installed with curl did the trick