如何解决“在'...”,“ mocha”:“ ^ 3.2.0”,“ s”“附近解析时JSON输入意外结束

时间:2019-10-21 10:27:37

标签: javascript npm webpack

我安装了reactreact-dom之后, 我需要安装webpack,但出现此错误。

我尝试安装babel-loader,以确保 npm internet 正常运行,并且安装正确。

日志:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\motamed\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'webpack',
1 verbose cli   '--save-dev' ]
2 info using npm@6.0.1
3 info using node@v10.16.3
4 verbose npm-session 069fb27ef2efc39d
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/webpack 688ms (from cache)
8 silly pacote tag manifest for webpack@latest fetched in 853ms
9 timing stage:loadCurrentTree Completed in 1796ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 4ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 182ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule webpack@4.41.2 checking installable status
17 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fast 172ms (from cache)
18 silly pacote version manifest for @webassemblyjs/ast@1.8.5 fetched in 184ms
19 silly resolveWithNewModule @webassemblyjs/ast@1.8.5 checking installable status
20 http fetch GET 304 https://registry.npmjs.org/json-parse-better-errors 163ms (from cache)
21 silly pacote range manifest for json-parse-better-errors@^1.0.2 fetched in 167ms
22 silly resolveWithNewModule json-parse-better-errors@1.0.2 checking installable status
23 http fetch GET 304 https://registry.npmjs.org/acorn 537ms (from cache)
24 http fetch GET 304 https://registry.npmjs.org/chrome-trace-event 548ms (from cache)
25 silly pacote range manifest for acorn@^6.2.1 fetched in 563ms
26 silly resolveWithNewModule acorn@6.3.0 checking installable status
27 http fetch GET 304 https://registry.npmjs.org/ajv-keywords 568ms (from cache)
28 silly pacote range manifest for chrome-trace-event@^1.0.2 fetched in 570ms
29 silly resolveWithNewModule chrome-trace-event@1.0.2 checking installable status
30 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fwasm-parser 587ms (from cache)
31 silly pacote range manifest for ajv-keywords@^3.4.1 fetched in 607ms
32 silly resolveWithNewModule ajv-keywords@3.4.1 checking installable status
33 http fetch GET 304 https://registry.npmjs.org/loader-runner 270ms (from cache)
34 silly pacote version manifest for @webassemblyjs/wasm-parser@1.8.5 fetched in 630ms
35 silly resolveWithNewModule @webassemblyjs/wasm-parser@1.8.5 checking installable status
36 silly pacote range manifest for loader-runner@^2.4.0 fetched in 303ms
37 silly resolveWithNewModule loader-runner@2.4.0 checking installable status
38 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fhelper-module-context 665ms (from cache)
39 silly pacote version manifest for @webassemblyjs/helper-module-context@1.8.5 fetched in 691ms
40 silly resolveWithNewModule @webassemblyjs/helper-module-context@1.8.5 checking installable status
41 http fetch GET 304 https://registry.npmjs.org/eslint-scope 694ms (from cache)
42 silly pacote range manifest for eslint-scope@^4.0.3 fetched in 711ms
43 silly resolveWithNewModule eslint-scope@4.0.3 checking installable status
44 http fetch GET 304 https://registry.npmjs.org/ajv 727ms (from cache)
45 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fwasm-edit 762ms (from cache)
46 silly pacote range manifest for ajv@^6.10.2 fetched in 784ms
47 silly resolveWithNewModule ajv@6.10.2 checking installable status
48 http fetch GET 304 https://registry.npmjs.org/enhanced-resolve 786ms (from cache)
49 silly pacote version manifest for @webassemblyjs/wasm-edit@1.8.5 fetched in 802ms
50 silly resolveWithNewModule @webassemblyjs/wasm-edit@1.8.5 checking installable status
51 silly pacote range manifest for enhanced-resolve@^4.1.0 fetched in 826ms
52 silly resolveWithNewModule enhanced-resolve@4.1.1 checking installable status
53 http fetch GET 304 https://registry.npmjs.org/memory-fs 331ms (from cache)
54 silly pacote range manifest for memory-fs@^0.4.1 fetched in 354ms
55 silly resolveWithNewModule memory-fs@0.4.1 checking installable status
56 http fetch GET 304 https://registry.npmjs.org/node-libs-browser 293ms (from cache)
57 http fetch GET 304 https://registry.npmjs.org/neo-async 319ms (from cache)
58 http fetch GET 304 https://registry.npmjs.org/micromatch 360ms (from cache)
59 http fetch GET 304 https://registry.npmjs.org/schema-utils 293ms (from cache)
60 silly pacote range manifest for node-libs-browser@^2.2.1 fetched in 331ms
61 silly resolveWithNewModule node-libs-browser@2.2.1 checking installable status
62 http fetch GET 304 https://registry.npmjs.org/tapable 276ms (from cache)
63 silly pacote range manifest for neo-async@^2.6.1 fetched in 365ms
64 silly resolveWithNewModule neo-async@2.6.1 checking installable status
65 silly pacote range manifest for micromatch@^3.1.10 fetched in 401ms
66 silly resolveWithNewModule micromatch@3.1.10 checking installable status
67 silly pacote range manifest for schema-utils@^1.0.0 fetched in 328ms
68 silly resolveWithNewModule schema-utils@1.0.0 checking installable status
69 silly pacote range manifest for tapable@^1.1.3 fetched in 299ms
70 silly resolveWithNewModule tapable@1.1.3 checking installable status
71 http fetch GET 304 https://registry.npmjs.org/terser-webpack-plugin 295ms (from cache)
72 silly pacote range manifest for terser-webpack-plugin@^1.4.1 fetched in 308ms
73 silly resolveWithNewModule terser-webpack-plugin@1.4.1 checking installable status
74 http fetch GET 304 https://registry.npmjs.org/watchpack 243ms (from cache)
75 http fetch GET 304 https://registry.npmjs.org/webpack-sources 236ms (from cache)
76 silly pacote range manifest for watchpack@^1.6.0 fetched in 262ms
77 silly resolveWithNewModule watchpack@1.6.0 checking installable status
78 silly pacote range manifest for webpack-sources@^1.4.1 fetched in 256ms
79 silly resolveWithNewModule webpack-sources@1.4.3 checking installable status
80 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fhelper-wasm-bytecode 151ms (from cache)
81 silly pacote version manifest for @webassemblyjs/helper-wasm-bytecode@1.8.5 fetched in 158ms
82 silly resolveWithNewModule @webassemblyjs/helper-wasm-bytecode@1.8.5 checking installable status
83 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fwast-parser 160ms (from cache)
84 silly pacote version manifest for @webassemblyjs/wast-parser@1.8.5 fetched in 172ms
85 silly resolveWithNewModule @webassemblyjs/wast-parser@1.8.5 checking installable status
86 http fetch GET 304 https://registry.npmjs.org/mamacro 120ms (from cache)
87 silly pacote range manifest for mamacro@^0.0.3 fetched in 124ms
88 silly resolveWithNewModule mamacro@0.0.3 checking installable status
89 http fetch GET 200 https://registry.npmjs.org/@xtuc%2flong 36ms (from cache)
90 silly pacote version manifest for @xtuc/long@4.2.2 fetched in 39ms
91 silly resolveWithNewModule @xtuc/long@4.2.2 checking installable status
92 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fhelper-api-error 290ms (from cache)
93 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2ffloating-point-hex-parser 298ms (from cache)
94 silly pacote version manifest for @webassemblyjs/helper-api-error@1.8.5 fetched in 302ms
95 silly resolveWithNewModule @webassemblyjs/helper-api-error@1.8.5 checking installable status
96 silly pacote version manifest for @webassemblyjs/floating-point-hex-parser@1.8.5 fetched in 307ms
97 silly resolveWithNewModule @webassemblyjs/floating-point-hex-parser@1.8.5 checking installable status
98 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fhelper-fsm 306ms (from cache)
99 silly pacote version manifest for @webassemblyjs/helper-fsm@1.8.5 fetched in 310ms
100 silly resolveWithNewModule @webassemblyjs/helper-fsm@1.8.5 checking installable status
101 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fhelper-code-frame 313ms (from cache)
102 silly pacote version manifest for @webassemblyjs/helper-code-frame@1.8.5 fetched in 320ms
103 silly resolveWithNewModule @webassemblyjs/helper-code-frame@1.8.5 checking installable status
104 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fwast-printer 124ms (from cache)
105 silly pacote version manifest for @webassemblyjs/wast-printer@1.8.5 fetched in 131ms
106 silly resolveWithNewModule @webassemblyjs/wast-printer@1.8.5 checking installable status
107 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fhelper-buffer 195ms (from cache)
108 silly pacote version manifest for @webassemblyjs/helper-buffer@1.8.5 fetched in 211ms
109 silly resolveWithNewModule @webassemblyjs/helper-buffer@1.8.5 checking installable status
110 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fhelper-wasm-section 226ms (from cache)
111 silly pacote version manifest for @webassemblyjs/helper-wasm-section@1.8.5 fetched in 233ms
112 silly resolveWithNewModule @webassemblyjs/helper-wasm-section@1.8.5 checking installable status
113 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fwasm-gen 234ms (from cache)
114 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fwasm-opt 242ms (from cache)
115 silly pacote version manifest for @webassemblyjs/wasm-gen@1.8.5 fetched in 247ms
116 silly resolveWithNewModule @webassemblyjs/wasm-gen@1.8.5 checking installable status
117 silly pacote version manifest for @webassemblyjs/wasm-opt@1.8.5 fetched in 248ms
118 silly resolveWithNewModule @webassemblyjs/wasm-opt@1.8.5 checking installable status
119 http fetch GET 304 https://registry.npmjs.org/@webassemblyjs%2fieee754 149ms (from cache)

375 silly resolveWithNewModule is-accessor-descriptor@0.1.6 checking installable status
376 silly pacote range manifest for kind-of@^3.0.2 fetched in 5ms
377 silly resolveWithNewModule kind-of@3.2.2 checking installable status
378 silly pacote range manifest for kind-of@^3.0.2 fetched in 3ms
379 silly resolveWithNewModule kind-of@3.2.2 checking installable status
380 silly pacote range manifest for define-
427 silly saveTree | | `-- js-tokens@4.0.0
427 silly saveTree | +-- object-assign@4.1.1
427 silly saveTree | +-- prop-types@15.7.2
427 silly saveTree | | `-- react-is@16.10.2
427 silly saveTree | `-- scheduler@0.16.2
427 silly saveTree +-- react@16.10.2
427 silly saveTree `-- webpack@4.41.2
427 silly saveTree   +-- @webassemblyjs/ast@1.8.5
427 silly saveTree   | +-- @webassemblyjs/helper-module-context@1.8.5
427 silly saveTree   | | `-- mamacro@0.0.3
427 silly saveTree   | +-- @webassemblyjs/helper-wasm-bytecode@1.8.5
427 silly saveTree   | `-- @webassemblyjs/wast-parser@1.8.5
427 silly saveTree   |   +-- @webassemblyjs/floating-point-hex-parser@1.8.5
427 silly saveTree   |   +-- @webassemblyjs/helper-api-error@1.8.5
427 silly saveTree   |   +-- @webassemblyjs/helper-code-frame@1.8.5
427 silly saveTree   |   | `-- @webassemblyjs/wast-printer@1.8.5
427 silly saveTree   |   |   `-- @xtuc/long@4.2.2
427 silly saveTree   |   +-- @webassemblyjs/helper-fsm@1.8.5
427 silly saveTree   |   `-- @xtuc/long@4.2.2
427 silly saveTree   +-- @webassemblyjs/helper-module-context@1.8.5
427 silly saveTree   +-- @webassemblyjs/wasm-edit@1.8.5
427 silly saveTree   | +-- @webassemblyjs/helper-buffer@1.8.5
427 silly saveTree   | +-- @webassemblyjs/helper-wasm-section@1.8.5
427 silly saveTree   | | `-- @webassemblyjs/wasm-gen@1.8.5
427 silly saveTree   | |   +-- @webassemblyjs/ieee754@1.8.5
427 silly saveTree   | |   | `-- @xtuc/ieee754@1.2.0
427 silly saveTree   | |   +-- @webassemblyjs/leb128@1.8.5
427 silly saveTree   | |   `-- @webassemblyjs/utf8@1.8.5
427 silly saveTree   | +-- @webassemblyjs/wasm-gen@1.8.5
427 silly saveTree   | +-- @webassemblyjs/wasm-opt@1.8.5
427 silly saveTree   | | `-- @webassemblyjs/wasm-parser@1.8.5
427 silly saveTree   | `-- @webassemblyjs/wasm-parser@1.8.5
427 silly saveTree   +-- @webassemblyjs/wasm-parser@1.8.5
427 silly saveTree   +-- acorn@6.3.0
427 silly saveTree   +-- ajv-keywords@3.4.1
427 silly saveTree   | |   +-- define-property@2.0.2
427 silly saveTree   | |   `-- regex-not@1.0.2
427 silly saveTree   | +-- define-property@2.0.2
427 silly saveTree   | +-- extend-shallow@3.0.2
427 silly saveTree   | +-- extglob@2.0.4
427 silly saveTree   | | `-- fragment-cache@0.2.1
427 silly saveTree   | +-- fragment-cache@0.2.1
427 silly saveTree   | +-- kind-of@6.0.2
427 silly saveTree   | +-- nanomatch@1.2.13
427 silly saveTree   | | `-- object.pick@1.3.0
427 silly saveTree   | +-- object.pick@1.3.0
427 silly saveTree   | +-- regex-not@1.0.2
427 silly saveTree   | +-- snapdragon@0.8.2
427 silly saveTree   | `-- to-regex@3.0.2
427 silly saveTree   +-- neo-async@2.6.1
427 silly saveTree   +-- node-libs-browser@2.2.1
427 silly saveTree   +-- schema-utils@1.0.0
427 silly saveTree   +-- tapable@1.1.3
427 silly saveTree   +-- terser-webpack-plugin@1.4.1
427 silly saveTree   | `-- webpack-sources@1.4.3
427 silly saveTree   +-- watchpack@1.6.0
427 silly saveTree   `-- webpack-sources@1.4.3
428 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...","mocha":"^3.2.0","s'
428 verbose stack     at JSON.parse (<anonymous>)
428 verbose stack     at parseJson (C:\Users\motamed\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
428 verbose stack     at consumeBody.call.then.buffer (C:\Users\motamed\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
428 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
429 verbose cwd I:\RN\rn
430 verbose Windows_NT 6.1.7600
431 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\motamed\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "webpack" "--save-dev"
432 verbose node v10.16.3
433 verbose npm  v6.0.1
434 error Unexpected end of JSON input while parsing near '...","mocha":"^3.2.0","s'
435 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:3)

使用此

npm cache clean --force  

然后尝试再次执行命令