zoukankan      html  css  js  c++  java
  • bigSur npx创建react应用出的错

    lambert@lantiandeMacBook-Air resources % npx create-react-app web-root
    
    Creating a new React app in /Users/lambert/IdeaProjects/springMvc/web/WEB-INF/resources/web-root.
    
    Installing packages. This might take a couple of minutes.
    Installing react, react-dom, and react-scripts with cra-template...
    
    npm ERR! code 1
    npm ERR! path /Users/lambert/IdeaProjects/springMvc/web/WEB-INF/resources/web-root/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/lambert/IdeaProjects/springMvc/web/WEB-INF/resources/web-root/node_modules/node-gyp/lib/configure.js:351:16)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
    npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
    npm ERR! gyp ERR! System Darwin 20.5.0
    npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/lambert/IdeaProjects/springMvc/web/WEB-INF/resources/web-root/node_modules/.bin/node-gyp" "rebuild"
    npm ERR! gyp ERR! cwd /Users/lambert/IdeaProjects/springMvc/web/WEB-INF/resources/web-root/node_modules/canvas
    npm ERR! gyp ERR! node -v v14.16.1
    npm ERR! gyp ERR! node-gyp -v v7.1.2
    npm ERR! gyp ERR! not ok
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/lambert/.npm/_logs/2021-06-04T01_25_43_962Z-debug.log
    
    Aborting installation.
      npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
    
    Deleting generated file... package.json
    Deleting web-root/ from /Users/lambert/IdeaProjects/springMvc/web/WEB-INF/resources
    Done.
    
    

    解决办法:
    brew install pkg-config cairo libpng jpeg giflib
    尝试了此方法无效!

    出现此错误的原因更新系统...
    参见原文链接

    有什么不同见解可以在评论区共同讨论
  • 相关阅读:
    UCML破解
    UCML快速开发平台学习1-UCML环境安装
    window系统安装jdk,jre
    解决Android报错No resource found that matches the given name (at 'text' with value '@string/hello').
    es6小技巧整理
    如何将项目推到github上面
    如何将时间格式化
    uni-app 页面跳转的两种方法
    layui表单校验及监听复选框选中状态的坑
    使用nvm管理多个不同版本的nodeJS之安装成功nodeJs之后使用npm报错的问题
  • 原文地址:https://www.cnblogs.com/lambertlt/p/14848278.html
Copyright © 2011-2022 走看看