Nuxt.jsのcreate-nuxt-appをインストールする際、 npx create-nuxt-app を実行するとエラーがおきてしまったので、対策方法を忘れないうちに。
環境
- windows 10
- git Bash
- node.js v10.15.0
- npm v6.4.1
原因
↓エラーコード ※一部抜粋
Error: EPERM: operation not permitted, mkdir 'C:\Users\User'
npxのGitを確認。
同じようなエラーがおきてる人が質問してました!
Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo'
どうやらディレクトリ名にスペースがあることでエラーになっているっぽい。
なぜ空白があるとエラーになるかは不明です・・・
C:\Users\User Name\ ← 「User Name」に空白あるのでエラーになった
解決方法
Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo'
この質問に対して、解決策を提案してくれてましたー
I was able to fix this in Windows by creating a directory junction to my users folder that didn't have a space in it. You can run a command like this in an administrative powershell:
> cmd /c mklink /J "C:\Users\myname" "C:\Users\My Name"
> You can then use this junction as if it were your real user directory:
>
> npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
> npm config set prefix C:\Users\myname\AppData\Roaming\npm
(the above should update your user .npmrc file)
実際に同じように、シンボリックリンクを作成。
npmのパスを変更してnpx create-nuxt-app を実行するとインストールしてくれました!
ただ、その後に「\Users\myname」までのパスがディレクトリ名になった謎のディレクトリが生成されてました…
2019/01/10 追記
謎ディレクトリ問題が解決しないので、npxをあきらめてyarnでパッケージをインストールし直しました。