nvm is not compatible with the npm config “prefix” option:

前端 未结 16 1434
梦毁少年i
梦毁少年i 2020-12-07 06:47

I am trying to run another NodeJS version with nvm but getting this error:

$ nvm use v4.2.4

nvm is not compatible with the npm config \"prefix\         


        
16条回答
  •  死守一世寂寞
    2020-12-07 07:37

    I was looking for a solution for the nvm prefix problem a found this question(before finding the solution). Here is my shell "dialog". I hope, it can be usefull for somebody. I was able to set to prefix with the help of this post: https://github.com/npm/npm/issues/6592

    When I tried npm config delete prefix or nvm use --delete-prefix before using npm --prefix="" set prefix "", I got only: npm ERR! not ok code 0

    Note that you will have to repeat the same procedure with every node version, the prefix is set back to (in my case) /usr/local after installation.

        $ nvm install 0.10
        ######################################################################## 100.0%
        nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local"
        Run `npm config delete prefix` or `nvm use --delete-prefix v0.10.44` to unset it.
        $ npm --prefix="" set prefix ""
        $ nvm use 0.10.44
        nvm is not compatible with the npm config "prefix" option: currently set to "/home/john"
        Run `npm config delete prefix` or `nvm use --delete-prefix v0.10.44` to unset it.
        $ nvm use --delete-prefix v0.10.44
        Now using node v0.10.44 (npm v1.3.10)
        $ nvm ls
        v0.10.44
                 v4.4.3
        ->       system
        default -> 4.4.3 (-> v4.4.3)
        node -> stable (-> v4.4.3) (default)
        stable -> 4.4 (-> v4.4.3) (default)
        iojs -> N/A (default)
        $ npm config get prefix
        /usr/local
    

提交回复
热议问题