Can't uninstall global npm packages after installing nvm

后端 未结 6 946
梦谈多话
梦谈多话 2020-12-03 06:29

I\'ve found several threads related to this issue but none seem to deal with my case specifically and I\'ve been unable to solve using the suggestions I\'ve found.

6条回答
  •  庸人自扰
    2020-12-03 07:30

    Sorry I know this is an old question but here we are in 2019 and was just an issue for me ... what I found is that I needed to invoke uninstall on the npm at the path that NVM cares about.

    Here's what worked for me:

    Tue Aug 20 08:09:07 ~
     $ npm uninstall -g edgemicro@3.0.4
    up to date in 0.051s
    Tue Aug 20 08:09:13 ~
     $ edgemicro --version
    current nodejs version is v8.16.0
    current edgemicro version is 3.0.4
    3.0.4
    // Clearly didn’t work :(
    
    // Let’s try sudo ….
    Tue Aug 20 08:09:18 ~
     $ sudo npm uninstall -g edgemicro@3.0.4
    Password:
    up to date in 0.035s
    Tue Aug 20 08:10:20 ~
     $ edgemicro --version
    current nodejs version is v8.16.0
    current edgemicro version is 3.0.4
    3.0.4
    // Still didn’t work :(
    
    // So where is this seemingly immortal executable?
    Tue Aug 20 08:10:28 ~
     $ which edgemicro
    /Users//.nvm/versions/node/v8.16.0/bin/edgemicro
    // It’s under some NVM specific path it seems.
    // It seems NPM is also under some NVM specific path, kinda expected.
    Tue Aug 20 08:10:33 ~
     $ which npm
    /Users//.nvm/versions/node/v8.16.0/bin/npm
    
    // So let’s use that exact npm to perform the uninstall …
    Tue Aug 20 08:10:42 ~
     $ /Users//.nvm/versions/node/v8.16.0/bin/npm uninstall -g edgemicro
    npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I'll try to do my best with it!
    removed 2442 packages in 25.851s
    Tue Aug 20 08:11:24 ~
     $ which edgemicro
    Tue Aug 20 08:11:29 ~
     $ // Done.
    

提交回复
热议问题