Bowen
Bowen

Reputation: 55

How to reinstall npm?

Last time I typed the following commands in cmd:

npm config set prefix "D:\nodejs\node_global"
npm config set cache "D:\nodejs\node_cache"

However, then I found that I've entered the wrong path. Actually my node_global and node_cache are in F disk, while I even don't have D disk in my computer. Now, no matter what npm command I enter, such as

npm -v

Or

npm install <package_name> -g

, there will be the following error:

UNKNOWN: unknown error, mkdir 'D:\nodejs\node_global' at Error <native>

I have tried to reinstall the nodejs, but the error still exists. Therefore, I want to know that if there is any method that can remove npm and then install it again? Or if there is any other solution that can fix my problem?

Upvotes: 0

Views: 2746

Answers (1)

isvforall
isvforall

Reputation: 8926

Open the file named .npmrc in your home directory(C:\Users\yourname) and simply remove this line prefix=D:\nodejs\node_global

Upvotes: 1

Related Questions