背时小孩马先生 2021-08-18 15:25 采纳率: 0%
浏览 35

使用react脚手架搭建项目就报这个错误是为什么啊,我已经设置的淘宝镜像,node-sass也设置了,是因为我的node版本太高了??

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...

npm ERR! code 1
npm ERR! path C:\Users\MHX\Desktop\react-demo\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! c:\users\mhx\desktop\react-demo\node_modules\canvas\src\backend\backend.h(3): fatal error C1083: �޷��򿪰��  ��ļ�: ��cairo.h��: No such file or directory [C:\Users\MHX\Desktop\react-demo\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 (C:\Users\MHX\Desktop\react-demo\node_modules\node-gyp\lib\build.js:194:23)
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 Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\MHX\\Desktop\\react-demo\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\MHX\Desktop\react-demo\node_modules\canvas
npm ERR! gyp ERR! node -v v14.16.0
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\MHX\AppData\Local\npm-cache\_logs\2021-08-18T07_22_00_214Z-debug.log

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

Deleting generated file... node_modules
(node:22516) UnhandledPromiseRejectionWarning: Error: EBUSY: resource busy or locked, rmdir 'C:\Users\MHX\Desktop\react-demo\node_modules\node-sass'
    at Object.rmdirSync (fs.js:890:10)
    at rmdirSync (C:\Users\MHX\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:264:13)
    at rimrafSync (C:\Users\MHX\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:243:7)
    at C:\Users\MHX\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\MHX\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:279:26)
    at rmdirSync (C:\Users\MHX\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\MHX\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:243:7)
    at C:\Users\MHX\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:554:18
    at Array.forEach (<anonymous>)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:22516) 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:22516) [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.

  • 写回答

2条回答 默认 最新

  • 崽崽的谷雨 2021-08-18 16:22
    关注

    Aborting installation.
    npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template-typescript has failed. //意思是下载react-dom。。。。错误
    从这个推断是网络原因。
    你可以使用cnpm或者yarn

    评论

报告相同问题?

问题事件

  • 创建了问题 8月18日

悬赏问题

  • ¥15 pragma pack没起作用
  • ¥20 如何实现关闭某一个应用程序后,自动运行一个批处理文件。
  • ¥15 关于 S7-PLCSIM Advanced 5.0本地TCP连接无法读写数据
  • ¥15 关于温度改变石墨烯介电性能(关键词-介电常数)
  • ¥150 HDMI分路器LT86102 的输出在890MHz频点处EMC超标8DB
  • ¥15 druid(相关搜索:数据库|防火墙)
  • ¥15 大一python作业
  • ¥15 preLaunchTask"C/C++: aarch64- apple-darwin22-g++-14 生成活动 文件”已终止,退出代码为-1。
  • ¥60 如何鉴定微信小程序数据被篡改过
  • ¥18 关于#贝叶斯概率#的问题:这篇文章中利用em算法求出了对数似然值作为概率表参数,然后进行概率表计算,这个概率表是怎样计算的呀