npm install error解析附近时JSON输入意外结束

时间:2020-05-31 12:31:01

标签: node.js reactjs npm npm-install

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'react-bootstrap',
1 verbose cli   'bootstrap'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v12.17.0
4 verbose npm-session 4004d1d4d37ac517
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/react-bootstrap 521ms
8 silly fetchPackageMetaData error for react-bootstrap@latest Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
9 http fetch GET 200 https://registry.npmjs.org/bootstrap 521ms
10 silly fetchPackageMetaData error for bootstrap@latest Unexpected end of JSON input while parsing near '...7bc2df7ec608869c9c8",'
11 timing stage:rollbackFailedOptional Completed in 0ms
12 timing stage:runTopLevelLifecycles Completed in 3560ms
13 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
13 verbose stack     at JSON.parse (<anonymous>)
13 verbose stack     at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
13 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
13 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
14 verbose cwd D:\Talk2Tutor\material-kit-react-master
15 verbose Windows_NT 10.0.17134
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "react-bootstrap" "bootstrap"
17 verbose node v12.17.0
18 verbose npm  v6.14.4
19 error Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
20 verbose exit [ 1, true ]

运行npm时出现上述错误,我是react-bootstrap引导程序。错误发生后,我尝试了 npm cache clean --force ,但是它不能解决我的问题。然后,我重新安装了节点,并尝试安装依赖项,但仍然出现错误,安装失败。任何人都可以修复此错误。我尝试了相关问题中提到的所有事情。但这并不能解决我的问题。我使用节点v12.17.0和npm 6.14.4。

3 个答案:

答案 0 :(得分:0)

如果您使用的是Bootstrap JS,则必须

Popper.js。检查docs

答案 1 :(得分:0)

使用npm-windows-upgrade升级npm解决了该问题。

答案 2 :(得分:0)

我尝试执行命令<script src="OrbitControls.js"></script> ,然后执行了导致该错误的命令,并且运行正常。