Error: npm is known not to run on Node.js V4.2.6

前端 未结 8 1700
名媛妹妹
名媛妹妹 2020-12-30 20:01

how can I solve the following error? I use Ubuntu 16. When I run any npm command such as \"npm run dev\" I get this error:

ERROR: npm is known not to

相关标签:
8条回答
  • 2020-12-30 20:09

    You can also use NVM - I did this to solve the same problem.

    first type

    nvm ls-remote to view the latest versions available,

    then

    nvm install [version] (I used v8.7.0)

    everything should be fine after that.

    0 讨论(0)
  • 2020-12-30 20:11

    First, Uninstall completely nodejs and npm.

    sudo apt remove nodejs npm
    

    Then, reinstall it over the link below:

    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    sudo apt-get install -y nodejs
    

    Refer: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

    0 讨论(0)
  • 2020-12-30 20:12

    I just had this issue on Ubuntu 16. Use n to update to the latest version

    sudo n latest
    

    That should settle it.

    0 讨论(0)
  • 2020-12-30 20:20

    I had a similar problem but my project is part of a bigger system so neither switching to nvm instead of npm nor upgrading my version of Node.js were options.

    However, moving npm backwards to a previous version was an option. I found 4.6.1 worked without complaint.

    sudo npm install -g npm@4.6.1
    

    This version of npm did not complain.

    0 讨论(0)
  • 2020-12-30 20:21

    I download latest install package from https://nodejs.org/en/ and reinstall it. Solve it!

    0 讨论(0)
  • 2020-12-30 20:21

    Get latest release with

    $ nvm install node 
    

    Then run the following

    $ nvm alias default stable_node_version
    
    0 讨论(0)
提交回复
热议问题