Closed5
`bunx create-next-app@latest`で`Error: EACCES: permission denied`が発生する
まとめ
- 権限が足りてないっぽいので
sudo chown -R 502:20 "{対象パス}
を実行すると解消した
やりたいこと
- React アプリを bun でビルドしたい
環境
- M1 Mac (Ventura 13.4.1)
- Nix shell を利用(
nix-shell -p bun
)
事象
実行したコマンド
bunx create-next-app@latest
発生したエラー
Aborting installation.
Unexpected error. Please report it as a bug:
Error: EACCES: permission denied, open '/Users/nix/Library/Preferences/create-next-app-nodejs/config.json.tmp-39732010783f717b'
at openSync (node:fs:581:18)
at attempt (/Users/nix/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:8:43165)
at Object.writeFileSync (/Users/nix/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:8:38664)
at Conf._write (/Users/nix/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:8:81857)
at set store [as store] (/Users/nix/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:8:80303)
at Conf.set (/Users/nix/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:8:78907)
at run (/Users/nix/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:74:51761)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/Users/nix/Library/Preferences/create-next-app-nodejs/config.json.tmp-39732010783f717b'
}
/Users/nix/Library/Preferences/create-next-app-nodejs
に一時ファイルを作成できてないようなので、権限を与える
sudo chown -R 502:20 "/Users/nix/Library/Preferences/create-next-app-nodejs"
再トライ
bunx create-next-app@latest
無事動いた
$ bunx create-next-app@latest
✔ What is your project named? … frontend
✔ Would you like to use TypeScript? … No / Yes
✔ Would you like to use ESLint? … No / Yes
✔ Would you like to use Tailwind CSS? … No / Yes
✔ Would you like to use `src/` directory? … No / Yes
✔ Would you like to use App Router? (recommended) … No / Yes
✔ Would you like to customize the default import alias (@/*)? … No / Yes
Creating a new Next.js app in /Users/nix/ghq/github.com/mitsuoka0423/ukkari-reminder/frontend.
Using bun.
Initializing project with template: app
Installing dependencies:
- react
- react-dom
- next
Installing devDependencies:
- typescript
- @types/node
- @types/react
- @types/react-dom
- eslint
- eslint-config-next
bun install v1.0.17 (5e60861c)
+ @types/node@20.10.6
+ @types/react@18.2.46
+ @types/react-dom@18.2.18
+ eslint@8.56.0
+ eslint-config-next@14.0.4
+ typescript@5.3.3
+ next@14.0.4
+ react@18.2.0
+ react-dom@18.2.0
279 packages installed [2.20s]
Success! Created frontend at /Users/nix/ghq/github.com/mitsuoka0423/ukkari-reminder/frontend
このスクラップは2023/12/31にクローズされました