LoginSignup
0
0

More than 3 years have passed since last update.

npm install -g create-react-appでcheckPermissions が出た時の対処法

Last updated at Posted at 2019-12-15

状況

macで、udemyの動画でreactを勉強するために
npm install -g create-react-app
で最新版をインストールしようとしたところ、

npm WARN checkPermissions Missing write access to /Users/tagawahirotaka/.npm-global/lib/node_modules/create-react-app

と怒られた。

解決できなかった策

npmでpermission deniedになった時の対処法[mac]
を参考にして、pathの設定をしたりbrewでnodeをインストールしたりしても同じエラーがでた。

解決策

エラー文に

npm ERR! path /Users/tagawahirotaka/.npm-global/lib/node_modules/create-react-app
enoent ENOENT: no such file or directory, access '/Users/tagawahirotaka/.npm-global/lib/node_modules/create-react-app'

とあったので、なんだかよく分からないが、
/Users/tagawahirotaka/.npm-global/lib/node_modules/create-react-app
にあったcreate-react-appを削除した。

その後、npm install -g create-react-appをしたら、
/Users/tagawahirotaka/.npm-global/bin/create-react-app
ができて無事に最新版がインストールできた。

が、しかし

npm startをしたところ、

A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.

というエラーに遭遇。

ひさしぶりにcreate-react-appしたらテンプレートができなかった時の対処法
この記事を参考にし、
npm uninstall -g create-react-app
yarn create react-app my-app
yarn start
でいけた。

が、しかし

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

というエラーに遭遇。
webpackがプロジェクトフォルダーではないところにインストールされてしまっているのが原因らしいので、
/Users/tagawahirotaka/node_modules/webpack を削除。
その後、yarn startでいけた。

0
0
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
0
0