【问题标题】:npm error while installing express in nodejs在 nodejs 中安装 express 时出现 npm 错误
【发布时间】:2020-01-28 21:10:50
【问题描述】:

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

>  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 ]

【问题讨论】:

    标签: node.js json express npm verbose


    【解决方案1】:

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

    npm cache clean --force
    

    然后安装快递

      npm install express
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-02
      • 2015-01-15
      • 1970-01-01
      • 1970-01-01
      • 2015-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多