Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

创建react项目抱的错误,完全没见过

创建一个react项目无法创建成功,一直抱这个错,有大神知道什么原因吗?

图片

image.png

详情

npm ERR! code 1
npm ERR! path /Users/caijizhou/Documents/reactdemo/demo/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/caijizhou/Documents/reactdemo/demo/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:327:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
npm ERR! gyp ERR! System Darwin 18.7.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/15.1.0/bin/node" "/Users/caijizhou/Documents/reactdemo/demo/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/caijizhou/Documents/reactdemo/demo/node_modules/canvas
npm ERR! gyp ERR! node -v v15.1.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/caijizhou/.npm/_logs/2020-11-07T03_16_50_623Z-debug.log


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

试一试执行sudo npm install --unsafe-perm,可能是npm版本的原因,或者重新安装一下gyp?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...