简体   繁体   English

nvm 与 npm 配置“前缀”选项不兼容:

[英]nvm is not compatible with the npm config "prefix" option:

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个 NodeJS 版本,但出现此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我有意设置前缀以避免sudo npm (参见https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

There are just two commands to resolve this issue.只有两个命令可以解决此问题。 Some users may also be getting the error as soon as they are also opening the terminal.某些用户也可能在打开终端后立即收到错误消息。 The first thing they see is this error:他们首先看到的是这个错误:

nvm is not compatible with the npm config "prefix" option: 
currently set to "/Users/z/.npm-global"

Run npm config delete prefix or nvm use --delete-prefix v4.2.4 to unset it.运行npm config delete prefixnvm use --delete-prefix v4.2.4取消设置。

So to resolve this issue, Run the following two commands.因此,要解决此问题,请运行以下两个命令。 Note: Change the version number as the same they are showing in your error.注意:将版本号更改为它们在您的错误中显示的版本号。

$ npm config delete prefix 
$ npm config set prefix $NVM_DIR/versions/node/v6.11.1

Note: This will also work if your terminal is using zsh.注意:如果您的终端使用 zsh,这也适用。

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

I faced the same issue, This is because of conflicting the npm of node and nodejs我遇到了同样的问题,这是因为 node 和 nodejs 的 npm 冲突

so remove nodejs by below commands所以通过以下命令删除nodejs

sudo apt-get remove nodejs

this will remove all nodejs related Packages,这将删除所有与 nodejs 相关的包,

after the above command, you have to run autoremove command just like that在上面的命令之后,你必须像这样运行 autoremove 命令

sudo apt autoremove

this will solve the problem,这将解决问题,

Here is what I did and worked for me这是我为我所做和工作的

1- sudo su 1-须藤苏

2- root@antonio:\/home\/antonio# mv ~\/.nvm \/tmp\/<\/code> 2- root@antonio:\/home\/antonio# mv ~\/.nvm \/tmp\/<\/code>

3- root@antonio:\/home\/antonio# export NVM_DIR="\/tmp\/.nvm"<\/code> 3- root@antonio:\/home\/antonio# export NVM_DIR="\/tmp\/.nvm"<\/code>

4- root@antonio:\/home\/antonio# nvm use --delete-prefix v17.4.0<\/code> 4- root@antonio:\/home\/antonio# nvm use --delete-prefix v17.4.0<\/code>

5- `root@antonio:\/home\/antonio# node -v 5-`root@antonio:\/home\/antonio#节点-v

在此处输入图像描述<\/a> ` `

"

Following sh file helped my case以下 sh 文件帮助了我的案例

# nvmish.sh
unset npm_config_prefix
source $HOME/.nvm/nvm.sh
nvm use 18

I am trying to run another NodeJS version with nvm but getting this error:我正在尝试使用nvm运行另一个nvm版本,但收到此错误:

$ nvm use v4.2.4

nvm is not compatible with the npm config "prefix" option: 
   currently set to "/Users/z/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it.

I have my prefix set on purpose to avoid sudo npm (see https://docs.npmjs.com/getting-started/fixing-npm-permissions ).我故意设置了前缀以避免sudo npm (请参阅https://docs.npmjs.com/getting-started/fixing-npm-permissions )。

Is there any way I can use nvm without losing my prefix for globally installed packages?有什么方法可以使用nvm而不会丢失全局安装包的前缀?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM