创建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

阅读 3.4k
2 个回答

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

请问最后解决了吗???业遇到了相同的问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题