LoginSignup
11
6

More than 3 years have passed since last update.

WSLとVSCode使用時にnpm installするとEACCESエラーではまる。

Last updated at Posted at 2020-02-03

WSLとVSCodeを利用してReact+firebaseアプリの作成中にエラーに遭遇しました。

functions
npm install --save firebase
...中略...
npm ERR! Error: EACCES: permission denied, rename
'/home/~/functions/node_modules/grpc' 
-> '/home/~/functions/node_modules/.grpc.DELETE'

npm install --save firebaseのコマンドを叩くと、上記の権限エラーが発生しインストールが出来ませんでした。

環境

  • Windows 10 Home 1903
  • WSL Ubuntu 1804 LTS
  • VSCode 1.41.1
    • Remote - WSL 0.41.7

解決策

結論から言うと、VSCodeを閉じて、

functions
npm install --save firebase

コマンドを打てばインストールできました。

functions
[grpc] Success: "/home/~/functions/node_modules/grpc/
src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node" is installed via remote
+ firebase@7.8.0

こちらのスレッドによると、
Remote - WSLがファイルをロックしているようです。

ls -laでnode_modules以下の権限を見ると特にrootユーザーになっておらず、また、node_modulesを削除、nodeのバージョンを変えたり、nodebrewを削除してnvmを入れなおしても解決しなかったので、拍子抜けしました。

参考

Npm ERR! Error: EACCES: permission denied, rename (WSL with VS Code open)
Resolving EACCES permissions errors when installing packages globally
npm installでError:EACCESがでたら

11
6
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
11
6