npm install error `not foundram Files/nodejs/npm: 3: /mnt/c/Program Files/nodejs/npm:`

后端 未结 12 1891
礼貌的吻别
礼貌的吻别 2021-01-30 08:24

I have installed Ubuntu Bash on Windows. I already have nodejs and npm on my windows machine at C:\\Program Files\\nodejs. In the bash she

12条回答
  •  粉色の甜心
    2021-01-30 08:47

    I just read through many threads trying to do this. There is complete documentation for setting up node, nvm and npm in wsl, here: https://docs.microsoft.com/en-us/windows/nodejs/setup-on-wsl2

    If you already installed node and npm using the following commands,

    sudo apt-get install nodejs

    sudo apt-get install npm

    NPM will not work. You must first uninstall them using:

    sudo apt-get remove nodejs

    sudo apt-get remove npm

    follow the guide to completely uninstalling here: How can I completely uninstall nodejs, npm and node in Ubuntu 14.04

    Then reinstall from the windows guide referenced above. The windows guide has many other useful resources.

    The Tldr to install(from Microsoft Docs):

    sudo apt-get install curl

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

    nvm install --lts

提交回复
热议问题