strapiのインストールができない。サーバー立ち上げエラー

使用環境はvsコード、Macです

strapiをインストールしようと入力。

smac@smac nextjs % npx create-strapi-app@latest my-project3   

これで作れると思いきや


```ターミナル
? Choose your installation type Quickstart (recommended)
Creating a quickstart project.
Creating a new Strapi application at /Users/smac/Desktop/nextjs/my-project3.
Creating files.
Error while installing dependencies:
npm WARN config production Use `--omit=dev` instead.
npm WARN config optional Use `--omit=optional` to exclude optional dependencies, or
npm WARN config `--include=optional` to include them.
npm WARN config 
npm WARN config     Default value does install optional deps unless otherwise omitted.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated mailcomposer@3.12.0: This project is unmaintained
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated buildmail@3.10.0: This project is unmaintained
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Users/smac/Desktop/nextjs/my-project3/node_modules/sharp
npm ERR! command failed
npm ERR! command sh /var/folders/_4/9t0t66yj0_7bkvs_7svx5h800000gn/T/install-52cbb588.sh
npm ERR! sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.12.2/libvips-8.12.2-darwin-x64.tar.br
npm ERR! node:internal/fs/utils:347
npm ERR!     throw err;
npm ERR!     ^
npm ERR! 
npm ERR! Error: EACCES: permission denied, copyfile '/var/folders/_4/9t0t66yj0_7bkvs_7svx5h800000gn/T/44657-libvips-8.12.2-darwin-x64.tar.br' -> '/Users/smac/.npm/_libvips/libvips-8.12.2-darwin-x64.tar.br'
npm ERR!     at Object.copyFileSync (node:fs:2852:3)
npm ERR!     at WriteStream.<anonymous> (/Users/smac/Desktop/nextjs/my-project3/node_modules/sharp/install/libvips.js:204:20)
npm ERR!     at WriteStream.emit (node:events:513:28)
npm ERR!     at emitCloseNT (node:internal/streams/destroy:138:10)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:82:21) {
npm ERR!   errno: -13,
npm ERR!   syscall: 'copyfile',
npm ERR!   code: 'EACCES',
npm ERR!   path: '/var/folders/_4/9t0t66yj0_7bkvs_7svx5h800000gn/T/44657-libvips-8.12.2-darwin-x64.tar.br',
npm ERR!   dest: '/Users/smac/.npm/_libvips/libvips-8.12.2-darwin-x64.tar.br'
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/smac/.npm/_logs/2022-08-23T16_50_26_703Z-debug-0.log

 Keep trying!             

Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.
Fix the issues mentioned in the installation errors and try to run the following command:

cd /Users/smac/Desktop/nextjs/my-project3 && npm install
```



思いっきりエラー出た。

おそらく、
```
EACCES: permission denied, copyfile
```

が原因っぽい。

https://www.codegrepper.com/code-examples/javascript/Error%3A+EACCES%3A+permission+denied%2C

このサイトの、

```
sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules
```

を実行したら、正常にインストールができた！

４時間ぐらい戦いました。