簡體   English   中英

當我在運行 npm 安裝命令后收到錯誤時,如何從 github 克隆我的反應項目后運行

[英]How do I get my react project running after cloning it from github as I receive errors after running npm install command

所以我首先運行 git clone http://............ 它成功下載了項目

然后我運行 cd 來更改目錄。 這樣可行!

我在目錄下運行 npm install 在 cmd 行顯示如下錯誤

npm ERR! code EJSONPARSE
npm ERR! path C:\Users\Home\Documents\Ctr-Alt-Elite/package.json
npm ERR! JSON.parse Unexpected token "<" (0x3C) in JSON at position 625 while parsing near "...us-bar\": \"~1.1.0\",\r\n<<<<<<< HEAD\r\n    \"f..."
npm ERR! JSON.parse Failed to parse JSON data.
npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Home\AppData\Local\npm-cache\_logs\2021-12-08T17_53_50_035Z-debug.log

下面是 debug.log 文件

0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'start'
0 verbose cli ]
1 info using npm@8.1.2
2 info using node@v16.13.1
3 timing npm:load:whichnode Completed in 3ms
4 timing config:load:defaults Completed in 9ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 4ms
6 timing config:load:builtin Completed in 4ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\Users\Home\Documents\Ctr-Alt-Elite\.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\Home\.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Users\Home\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 2ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 21ms
19 timing npm:load:configload Completed in 22ms
20 timing npm:load:setTitle Completed in 1ms
21 timing npm:load:setupLog Completed in 1ms
22 timing config:load:flatten Completed in 4ms
23 timing npm:load:cleanupLog Completed in 6ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 7ms
26 timing npm:load Completed in 52ms
27 timing command:run-script Completed in 8ms
28 timing command:start Completed in 26ms
29 verbose stack JSONParseError: Unexpected token "<" (0x3C) in JSON at position 625 while parsing near "...us-bar\": \"~1.1.0\",\r\n<<<<<<< HEAD\r\n    \"f..."
29 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json-fast\index.js:11:61
29 verbose stack     at async RunScript.run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:87:19)
30 verbose cwd C:\Users\Home\Documents\Ctr-Alt-Elite
31 verbose Windows_NT 10.0.19043
32 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
33 verbose node v16.13.1
34 verbose npm  v8.1.2
35 error code EJSONPARSE
36 error path C:\Users\Home\Documents\Ctr-Alt-Elite/package.json
37 error JSON.parse Unexpected token "<" (0x3C) in JSON at position 625 while parsing near "...us-bar\": \"~1.1.0\",\r\n<<<<<<< HEAD\r\n    \"f..."
38 error JSON.parse Failed to parse JSON data.
38 error JSON.parse Note: package.json must be actual JSON, not just JavaScript.
39 verbose exit 1

看起來有人在 package.json 中發生了合並沖突,導致 JSON 無效。 請參閱有關如何合並的答案: https://stackoverflow.com/a/163659/9593504

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM