create-next-app 创建项目报错解决
source link: https://paugram.com/coding/create-next-app-xcode-error-fix.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
create-next-app 创建项目报错解决
问题:使用 create-next-app 创建项目,结果出现了报错,提示 No receipt for 'com.apple.pkg.CLTools_Executables' found
paul@PauldeiMac 项目 % npx create-next-app --typescript
✔ What is your project named? … next-app
Creating a new Next.js app in /Users/paul/Documents/项目/next-app.
Installing react, react-dom, and next using npm...
npm ERR! code 1
npm ERR! path /Users/paul/Documents/项目/next-app/node_modules/fibers
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
npm ERR!
npm ERR! xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (/Users/paul/Documents/项目/next-app/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:376:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:284:12)
npm ERR! gyp ERR! System Darwin 20.3.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/15.5.0/bin/node" "/Users/paul/Documents/项目/next-app/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/paul/Documents/项目/next-app/node_modules/fibers
npm ERR! gyp ERR! node -v v15.5.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
搜索了一下,需要更新 XCode Command Line Tools
sudo xcode-select -r
之后依然出现异常,只需要把我公司电脑的 XCode 打开一次激活就可以了... 比较好奇,为什么 NodeJS 要我 XCode?
npm ERR! code 1
npm ERR! path /Users/paul/Documents/项目/next-app/node_modules/fibers
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! You have not agreed to the Xcode license agreements, please run 'sudo xcodebuild -license' from within a Terminal window to review and agree to the Xcode license agreements.
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 69
npm ERR! gyp ERR! stack at ChildProcess.onExit (/Users/paul/Documents/项目/next-app/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:376:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:284:12)
npm ERR! gyp ERR! System Darwin 20.3.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/15.5.0/bin/node" "/Users/paul/Documents/项目/next-app/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/paul/Documents/项目/next-app/node_modules/fibers
npm ERR! gyp ERR! node -v v15.5.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
特立独行的一只前端菜狗。本站未注明转载的文章均为原创,并采用 CC BY-NC-SA 4.0 授权协议,转载请注明来源,谢谢!如本站内容对你有所帮助的话,不妨 捐助支持 一下?同时欢迎订阅关注 我的日记,唠嗑(分享)每日的折腾经历。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK