繁体   English   中英

在nodejs中安装express时出现npm错误

[英]npm error while installing express in nodejs

我在npm install express时遇到问题。 JSON 输入在 '..."dist":{"shasum":"e84' 附近解析时意外结束,这是我得到的错误。

>  0 info it worked if it ends with ok
>         1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
>         1 verbose cli   'C:\\Users\\Rakshith Rakshak\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
>         1 verbose cli   'install',
>         1 verbose cli   '-g',
>         1 verbose cli   'express' ]
>         2 info using npm@6.9.2
>         3 info using node@v10.15.3
>         4 verbose npm-session 203510227a9454ec
>         5 silly install loadCurrentTree
>         6 silly install readGlobalPackageData
>         7 http fetch GET 304 https://registry.npmjs.org/express 346ms (from cache)
>         8 silly fetchPackageMetaData error for express@latest Unexpected end of JSON input while parsing near
> '..."dist":{"shasum":"e84'
>         9 timing stage:rollbackFailedOptional Completed in 1ms
>         10 timing stage:runTopLevelLifecycles Completed in 417ms
>         11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."dist":{"shasum":"e84'
>         11 verbose stack     at JSON.parse (<anonymous>)
>         11 verbose stack     at parseJson (C:\Users\Rakshith Rakshak\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
>         11 verbose stack     at consumeBody.call.then.buffer (C:\Users\Rakshith
> Rakshak\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
>         11 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
>         12 verbose cwd D:\My Files\node\role-based-auth
>         13 verbose Windows_NT 10.0.18362
>         14 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Rakshith
> Rakshak\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js"
> "install" "-g" "express"
>         15 verbose node v10.15.3
>         16 verbose npm  v6.9.2
>         17 error Unexpected end of JSON input while parsing near '..."dist":{"shasum":"e84'
>         18 verbose exit [ 1, true ]

清除 NPM 缓存并尝试再次安装“Express”。 在下面运行命令

npm cache clean --force

然后安装快递

  npm install express

暂无
暂无

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

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