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

后端 未结 12 1747
礼貌的吻别
礼貌的吻别 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 09:12

    I had the same problem. This is what I did.

    Step 1. Type node -vand npm -vcommands in Windows PowerShell and check if node and npm are properly installed

    Step 2. Add this to the ~/.zshrc or ~/.bashrc file

    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
    

    Step 3. type source ~/.zshrc and/or source ~/.bashrc

    Step 4. Type node -vand npm -v commands in bash or zsh shells and the correct versions should now appear

    Hope this solves your problem. Peace! ✌

提交回复
热议问题