前端-海鸟 2021-06-15 17:45 采纳率: 50%
浏览 374
已结题

创建react项目报错,这个怎么解决

$ npx create-react-app myapp

Creating a new React app in E:\myblog\myapp.

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 E:\myblog\myapp\node_modules\canvas
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Warning: Missing input files:
npm ERR! C:\GTK\bin\libpangoft2-1.0-0.dll
npm ERR! C:\GTK\bin\zlib1.dll
npm ERR! C:\GTK\bin\libintl-8.dll
npm ERR! C:\GTK\bin\libgmodule-2.0-0.dll
npm ERR! C:\GTK\bin\libglib-2.0-0.dll
npm ERR! C:\GTK\bin\libexpat-1.dll
npm ERR! C:\GTK\bin\libpng14-14.dll
npm ERR! C:\GTK\bin\libcairo-2.dll
npm ERR! C:\GTK\bin\libfontconfig-1.dll
npm ERR! C:\GTK\bin\libgobject-2.0-0.dll
npm ERR! C:\GTK\bin\libgthread-2.0-0.dll
npm ERR! C:\GTK\bin\libpangocairo-1.0-0.dll
npm ERR! C:\GTK\bin\libfreetype-6.dll
npm ERR! C:\GTK\bin\libpango-1.0-0.dll
npm ERR! C:\GTK\bin\libpangowin32-1.0-0.dll
npm ERR! �ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�/m�����ء�
npm ERR!   Backend.cc
npm ERR! e:\myblog\myapp\node_modules\canvas\src\backend\backend.h(3): fatal error C1083: �޷��򿪰����ļ�: ��cairo.h��: No such file or directory [E:\myblog\myapp\node_modules\canvas\build\canvas.vcxproj]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (E:\myblog\myapp\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
npm ERR! gyp ERR! System Windows_NT 6.1.7601
npm ERR! gyp ERR! command "D:\\nodejs\\node.exe" "E:\\myblog\\myapp\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\myblog\myapp\node_modules\canvas
npm ERR! gyp ERR! node -v v12.16.2
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!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2021-06-15T09_39_59_887Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... node_modules
(node:10412) UnhandledPromiseRejectionWarning: Error: EBUSY: resource busy or locked, rmdir 'E:\myblog\myapp\node_modules\node-sass'
    at Object.rmdirSync (fs.js:770:3)
    at rmdirSync (C:\Users\Administrator\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:264:13)
    at rimrafSync (C:\Users\Administrator\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:243:7)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:279:39
    at Array.forEach (<anonymous>)
    at rmkidsSync (C:\Users\Administrator\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:279:26)
    at rmdirSync (C:\Users\Administrator\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:269:7)
    at Object.rimrafSync [as removeSync] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:243:7)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:554:18
    at Array.forEach (<anonymous>)
(node:10412) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10412) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

  • 写回答

1条回答 默认 最新

  • 码上流星&洒下星辰 前端领域新星创作者 2021-06-15 21:22
    关注

    这个报错我没有遇到过,但是我博客里面有一套完整的react创建项目的流程,你可以照着在重新跑一边看看具体是哪一步出了问题

    链接:https://blog.csdn.net/qq_47272950/article/details/117327625?spm=1001.2014.3001.5501

    如果你不需要mobx的话就不需要进行第五步,前三步跑完项目就可以起来了,望采纳,谢谢!

    评论

报告相同问题?

悬赏问题

  • ¥15 数据量少可以用MK趋势分析吗
  • ¥15 使用VH6501干扰RTR位,CANoe上显示的错误帧不足32个就进入bus off快慢恢复,为什么?
  • ¥15 大智慧怎么编写一个选股程序
  • ¥100 python 调用 cgps 命令获取 实时位置信息
  • ¥15 两台交换机分别是trunk接口和access接口为何无法通信,通信过程是如何?
  • ¥15 C语言使用vscode编码错误
  • ¥15 用KSV5转成本时,如何不生成那笔中间凭证
  • ¥20 ensp怎么配置让PC1和PC2通讯上
  • ¥50 有没有适合匹配类似图中的运动规律的图像处理算法
  • ¥15 dnat基础问题,本机发出,别人返回的包,不能命中