17
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WSL上で、Windowsのnpmを使ってしまう

Last updated at Posted at 2019-06-05

問題

Windows10で使用できるUbuntu(WSL)でnpmを使用すると、

: not foundram Files/nodejs/npm: 3
: /mnt/c/Program Files/nodejs/npm:: not foundram Files/nodejs/npm: 5
: /mnt/c/Program Files/nodejs/npm:/mnt/c/Program Files/nodejs/npm: 6
: /mnt/c/Program Files/nodejs/npm: Syntax error: word unexpected (expecting "in")

と出てしまう。

情報など

・Windows10 Pro 1809
・WSL Ubuntu 18.04.2 LTS
which npm -> /mnt/c/Program Files/nodejs/npm

解決策

vim ~/.bash_profilePATH="$HOME/bin:$HOME/.local/bin:$PATH"を書くだけ。
(zshの人は~/.bash_profileではなく~/.zshrc)

反映のためにsource ~/.bash_profileを実行し、
確認のためwhich npmをすると/home/USERNAME/.nodebrew/current/bin/npmと返ってきた。
(nodebrewを使ってるため、使っていない方は違うフォルダが指定される可能性大です。)

npm -v -> 5.6.0

参考

17
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?