简体   繁体   English

在 reactjs 中运行 npm install 时出现 node-gyp 构建错误

[英]node-gyp build error while running npm install in reactjs

在此处输入图片说明 I took a frontend project repo which is built on reactjs & WHILE I run npm i command it is giving me whole bunch of error.我使用了一个基于 reactjs 的前端项目存储库,当我运行npm i命令时,它给了我一大堆错误。

  1. I tried deleting package.lock.json file & again run the command我尝试删除package.lock.json文件并再次运行命令
  2. I tried by doing npm update我试过做 npm update
  3. I tried npm i --force & npm update --force But same error is giving ..我试过npm i --force & npm update --force但是同样的错误给了..

update更新

I forcely cache cleaned using this command npm cache clean -f .我使用此命令强制清除缓存npm cache clean -f After that I again run npm i .. now giviing this error...之后我再次运行npm i .. 现在给出这个错误......

0 verbose cli [ 0 详细的 cli [
0 verbose cli '/usr/local/Cellar/node/16.11.1/bin/node', 0 详细 cli '/usr/local/Cellar/node/16.11.1/bin/node',
0 verbose cli '/usr/local/bin/npm', 0 详细的 cli '/usr/local/bin/npm',
0 verbose cli 'i' 0 详细的 cli 'i'
0 verbose cli ] 0 详细 cli ]
1 info using npm@8.1.2 1 信息使用 npm@8.1.2
2 info using node@v16.11.1 2 信息使用 node@v16.11.1
3 timing npm:load:whichnode Completed in 0ms 3 计时 npm:load:whichnode 0ms 完成
4 timing config:load:defaults Completed in 2ms 4 计时 config:load:defaults 2ms 内完成
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 2ms 5 计时 config:load:file:/usr/local/lib/node_modules/npm/npmrc 2ms 内完成
6 timing config:load:builtin Completed in 2ms 6 时序 config:load:builtin 2ms 内完成
7 timing config:load:cli Completed in 2ms 7 计时 config:load:cli 2ms 内完成
8 timing config:load:env Completed in 1ms 8 计时 config:load:env 1ms 内完成
9 timing config:load:file:/Users/macbookpro/Desktop/private_project/xyzvara/to-let/.npmrc Completed in 1ms 9 计时 config:load:file:/Users/macbookpro/Desktop/private_project/xyzvara/to-let/.npmrc 1ms内完成
10 timing config:load:project Completed in 1ms 10 时序 config:load:project 1ms 内完成
11 timing config:load:file:/Users/macbookpro/.npmrc Completed in 0ms 11 计时 config:load:file:/Users/macbookpro/.npmrc 0ms完成
12 timing config:load:user Completed in 0ms 12 计时 config:load:user 0ms 内完成
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms 13 定时config:load:file:/usr/local/etc/npmrc 0ms完成
14 timing config:load:global Completed in 0ms 14 计时 config:load:global 0ms 内完成
15 timing config:load:validate Completed in 1ms 15 计时 config:load:validate 1ms 内完成
16 timing config:load:credentials Completed in 1ms 16 计时 config:load:credentials 1ms 内完成
17 timing config:load:setEnvs Completed in 1ms 17 时序 config:load:setEnvs 1ms 内完成
18 timing config:load Completed in 11ms 18 时序配置:加载在 11ms 内完成
19 timing npm:load:configload Completed in 11ms 19 计时 npm:load:configload 11ms 完成
20 timing npm:load:setTitle Completed in 3ms 20 计时 npm:load:setTitle 3ms 内完成
21 timing npm:load:setupLog Completed in 0ms 21 计时 npm:load:setupLog 0ms 内完成
22 timing config:load:flatten Completed in 4ms 22 时序 config:load:flatten 在 4ms 内完成
23 timing npm:load:cleanupLog Completed in 2ms 23 计时 npm:load:cleanupLog 2ms 内完成
24 timing npm:load:configScope Completed in 0ms 24 计时 npm:load:configScope 在 0ms 内完成
25 timing npm:load:projectScope Completed in 1ms 25 计时 npm:load:projectScope 1ms 内完成
26 timing npm:load Completed in 22ms 26 计时 npm:load 在 22ms 内完成
27 timing arborist:ctor Completed in 1ms 27 计时树艺师:ctor 1ms 内完成
28 timing arborist:ctor Completed in 0ms 28 计时树艺师:ctor 在 0ms 内完成
29 timing idealTree:init Completed in 19ms 29 时序idealTree:init 19ms完成
30 timing idealTree:userRequests Completed in 0ms 30 时序idealTree:userRequests 在0ms 内完成
31 silly idealTree buildDeps 31 愚蠢的idealTree buildDeps
32 silly fetch manifest @ckeditor/ckeditor5-build-classic@^25.0.0 32 傻获取清单@ckeditor/ckeditor5-build-classic@^25.0.0
33 http fetch GET 200 https://registry.npmjs.org/@ckeditor%2fckeditor5-build-classic 2340ms (cache miss) 33 http fetch GET 200 https://registry.npmjs.org/@ckeditor%2fckeditor5-build-classic 2340ms(缓存未命中)
34 silly fetch manifest @ckeditor/ckeditor5-react@^3.0.2 34 傻获取清单@ckeditor/ckeditor5-react@^3.0.2
35 http fetch GET 200 https://registry.npmjs.org/@ckeditor%2fckeditor5-react 2069ms (cache miss) 35 http fetch GET 200 https://registry.npmjs.org/@ckeditor%2fckeditor5-react 2069ms(缓存未命中)
36 silly fetch manifest react@^16.14.0 36 傻获取清单 react@^16.14.0
37 http fetch GET 200 https://registry.npmjs.org/react 905ms (cache miss) 37 http fetch GET 200 https://registry.npmjs.org/react 905ms(缓存未命中)
38 silly fetch manifest @hookform/devtools@^3.1.0 38 傻获取清单@hookform/devtools@^3.1.0
39 http fetch GET 200 https://registry.npmjs.org/@hookform%2fdevtools 1461ms (cache miss) 39 http 获取 GET 200 https://registry.npmjs.org/@hookform%2fdevtools 1461ms(缓存未命中)
40 silly fetch manifest react@>=17.0.2 40 愚蠢的获取清单 react@>=17.0.2
41 timing idealTree Completed in 6832ms 41 时序idealTree 6832ms完成
42 timing command:install Completed in 6858ms 42 计时命令:安装 6858ms 完成
43 verbose stack Error: unable to resolve dependency tree 43 详细堆栈错误:无法解析依赖树
43 verbose stack at Arborist.[failPeerConflict] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1356:25) Arborist.[failPeerConflict] 上的 43 详细堆栈 (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1356:25)
43 verbose stack at Arborist.[loadPeerSet] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1322:34) Arborist.[loadPeerSet] 上的 43 详细堆栈 (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1322:34)
43 verbose stack at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:930:11) 43 async Arborist.[buildDepStep] 的详细堆栈 (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:930:11)
43 verbose stack at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:216:7) 43 async Arborist.buildIdealTree 的详细堆栈 (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:216:7)
43 verbose stack at async Promise.all (index 1)异步 Promise.all 上的 43 详细堆栈(索引 1)
43 verbose stack at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:149:5) 43 async Arborist.reify 的详细堆栈 (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:149:5)
43 verbose stack at async Install.install (/usr/local/lib/node_modules/npm/lib/install.js:170:5) 43 详细堆栈在异步 Install.install (/usr/local/lib/node_modules/npm/lib/install.js:170:5)
44 verbose cwd /Users/macbookpro/Desktop/private_project/xyzvara/to-let 44 详细 cwd /Users/macbookpro/Desktop/private_project/xyzvara/to-let
45 verbose Darwin 20.3.0 45 冗长的达尔文 20.3.0
46 verbose argv "/usr/local/Cellar/node/16.11.1/bin/node" "/usr/local/bin/npm" "i" 46 详细 argv "/usr/local/Cellar/node/16.11.1/bin/node" "/usr/local/bin/npm" "i"
47 verbose node v16.11.1 47 详细节点 v16.11.1
48 verbose npm v8.1.2 48 冗长的 npm v8.1.2
49 error code ERESOLVE 49 错误代码 ERESOLVE
50 error ERESOLVE unable to resolve dependency tree 50 错误 ERESOLVE 无法解析依赖树
51 error 51 错误
52 error While resolving: [1mtolet[22m@[1m0.1.0[22m 52 错误解析时:[1mtolet[22m@[1m0.1.0[22m]
52 error Found: [1mreact[22m@[1m16.14.0[22m[2m[22m发现 52 错误:[1mreact[22m@[1m16.14.0[22m[2m[22m]]
52 error [2mnode_modules/react[22m 52 错误 [2mnode_modules/react[22m]
52 error [1mreact[22m@"[1m^16.14.0[22m" from the root project 52 错误 [1mreact[22m@"[1m^16.14.0[22m" 来自根项目
52 error 52 错误
52 error Could not resolve dependency: 52 错误无法解决依赖关系:
52 error [35mpeer[39m [1mreact[22m@"[1m>=17.0.2[22m" from [1m@hookform/devtools[22m@[1m3.1.0[22m[2m[22m 52 错误 [35mpeer[39m [1mreact[22m@"[1m>=17.0.2[22m"] 来自 [1m@hookform/devtools[22m@[1m3.1.0[22m[2m[22m]]
52 error [2mnode_modules/@hookform/devtools[22m 52 错误 [2mnode_modules/@hookform/devtools[22m]
52 error [1m@hookform/devtools[22m@"[1m^3.1.0[22m" from the root project 52 错误 [1m@hookform/devtools[22m@"[1m^3.1.0[22m" 来自根项目
52 error 52 错误
52 error Fix the upstream dependency conflict, or retry 52 error 修复上游依赖冲突,或者重试
52 error this command with --force, or --legacy-peer-deps 52 使用 --force 或 --legacy-peer-deps 错误此命令
52 error to accept an incorrect (and potentially broken) dependency resolution. 52 错误以接受不正确(并且可能已损坏)的依赖项解析。
52 error 52 错误
52 error See /Users/macbookpro/.npm/eresolve-report.txt for a full report. 52 错误请参阅 /Users/macbookpro/.npm/eresolve-report.txt 获取完整报告。
53 verbose exit 1 53 详细退出 1

update 2更新 2

I encountered an error that telling network error.我遇到了一个错误,告诉网络错误。 So, to faster loading speed I installed yarn & run yarn install .因此,为了更快的加载速度,我安装了yarn并运行yarn install After that strangely It installed node modules that was not happening while I was using npm .在那之后,奇怪的是它安装了我使用npm时没有发生的节点模块。 After that while tried to run the project It was giving node-sass error.之后,虽然尝试运行该项目,但它给出了 node-sass 错误。 so I did npm audit fix -f .所以我做了npm audit fix -f but, It didn't fix all error but if I run command to start the project it is now running without giving error.但是,它并没有修复所有错误,但是如果我运行命令来启动项目,它现在正在运行而不会出错。 Very strange , I don't have any perfect answer of this behaviour.很奇怪,我对这种行为没有任何完美的答案。

update 2更新 2

I encountered an error that telling network error.我遇到了一个错误,告诉网络错误。 So, to faster loading speed I installed yarn & run yarn install .因此,为了更快的加载速度,我安装了yarn并运行yarn install After that strangely It installed node modules that was not happening while I was using npm .在那之后,奇怪的是它安装了我使用npm时没有发生的节点模块。 After that while tried to run the project It was giving node-sass error.之后,虽然尝试运行该项目,但它给出了 node-sass 错误。 so I did npm audit fix -f .所以我做了npm audit fix -f but, It didn't fix all error but if I run command to start the project it is now running without giving error.但是,它并没有修复所有错误,但是如果我运行命令来启动项目,它现在正在运行而不会出错。 Very strange , I don't have any perfect answer of this behaviour.很奇怪,我对这种行为没有任何完美的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM