node.js - 创建反应应用程序 npx 创建反应应用程序失败
问题描述
总是显示这个:
在 C:\Users\ASUS\Desktop\desk\react1\my-app 中创建一个新的 React 应用程序。
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 C:\Users\ASUS\Desktop\desk\react1\my-app\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\asus\desktop\desk\react1\my-app\node_modules\canvas\src\backend\backend.h(3): fatal error C1083: ���������ļ�: ��cairo.h��: No such file or directory [C:\Users\ASUS\Desktop\desk\react1\my-app\node_modules\canvas\build\canvas.vcxproj]
npm ERR! (node:16632) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\ASUS\Desktop\desk\react1\my-app\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22463
npm ERR! gyp ERR! command "D:\\node.exe" "C:\\Users\\ASUS\\Desktop\\desk\\react1\\my-app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\ASUS\Desktop\desk\react1\my-app\node_modules\canvas
npm ERR! gyp ERR! node -v v16.6.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! C:\Users\ASUS\AppData\Local\npm-cache\_logs\2021-10-01T12_55_17_325Z-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:fs:1157
return handleErrorFromBinding(ctx);
^
Error: EBUSY: resource busy or locked, rmdir 'C:\Users\ASUS\Desktop\desk\react1\my-app\node_modules\node-sass'
at Object.rmdirSync (node:fs:1157:10)
at rmdirSync (C:\Users\ASUS\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:264:13)
at rimrafSync (C:\Users\ASUS\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:243:7)
at C:\Users\ASUS\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\ASUS\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:279:26)
at rmdirSync (C:\Users\ASUS\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\ASUS\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\remove\rimraf.js:243:7)
at C:\Users\ASUS\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:554:18
at Array.forEach (<anonymous>) {
errno: -4082,
syscall: 'rmdir',
code: 'EBUSY',
path: 'C:\\Users\\ASUS\\Desktop\\desk\\react1\\my-app\\node_modules\\node-sass'
}
解决方案
我曾经使用 C 的代码块,其中有一个名为 gtk 的文件夹。所以我删除了文件夹并且它可以工作。
推荐阅读
- json - 解组 JSON 时指向接口的指针与持有指针的接口
- angular - Angular http,下载照片功能在 Firefox 上不起作用
- python - 将字典附加到列表会覆盖 Python 中的所有字典
- javascript - 为什么我的按钮不起作用?
- mongodb - MongoDB更新奇怪的行为
- java - 文件字符集更改为 docker 容器中的二进制文件
- symfony - 字符串的长度树枝计数错误
- jmeter - Jmeter:聚合图显示使用合并结果插件的平均线程数
- opencv - 打开 CV 编解码器 FFMPEG 错误后备以使用标记 0x7634706d/'mp4v'
- laravel - Laravel 5想要访问模型中的auth用户ID