Error “Cannot find module 'npmlog'” after “npm update -g”

前端 未结 9 1279
轻奢々
轻奢々 2020-12-20 11:35

I have NVM 0.30.1 and used it to install node.js v5.4.0 (with NPM 3.5.4) on Fedora 22. When I run npm update -g, I receive the following warnings:



        
9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 11:57

    If you're using a Mac, perform the following steps, to remedy (assuming you have Homebrew installed already):

    sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
    

    (to overcome bash: /usr/local/bin/npm: No such file or directory error):

    hash -r 
    

    Then go ahead with updating brew (to keep its kegs up to date) and the reinstallation process, linking is optional.

    brew update
    
    brew reinstall node
    
    brew link --overwrite node
    

    At any point inbetween you can use npm -v or node -v to test whether or not you are making progress. If you have node returning a version, but not npm then you will need to add your path to your environment with:

    export PATH="/usr/local/bin:$PATH"
    

提交回复
热议问题