【问题标题】:npm ERR! Unexpected end of JSON input while parsing near '...nt":"^7.1.0","babel-p'npm 错误!在 '...nt":"^7.1.0","babel-p' 附近解析时 JSON 输入意外结束
【发布时间】:2020-05-01 08:47:26
【问题描述】:

我是新手,我正在尝试创建一个新的应用程序,但无论我做什么,我都会遇到同样的错误。

:npm 错误!在 '...nt":"^7.1.0","babel-p' 附近解析时 JSON 输入意外结束

我觉得 babel 有点问题。

C:\Users\Augustus\Desktop>npx create-react-app myapp

Creating a new React app in C:\Users\Augustus\Desktop\myapp.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

npm ERR! Unexpected end of JSON input while parsing near '...nt":"^7.1.0","babel-p'

npm ERR! A complete log of this run can be found in:


Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json
Deleting myapp/ from C:\Users\Augustus\Desktop
Done.

【问题讨论】:

    标签: javascript node.js reactjs


    【解决方案1】:

    强制重新安装

    通常您可以通过强制重新安装来修复这些类型的错误

    试试

    npm cache clean --force

    yarn --force

    取决于你是使用 npm 还是 yarn 进行包管理

    【讨论】:

      【解决方案2】:

      强制重新安装后,如果您发现仍然出现相同的错误,请检查您的互联网连接。在我切换到更快的提供商(在我的第三世界国家,互联网有时会很慢)之前,我遇到了同样的问题,之后它立即按应有的方式安装。

      【讨论】:

        猜你喜欢
        • 2021-01-04
        • 2019-05-14
        • 1970-01-01
        • 1970-01-01
        • 2020-09-18
        • 2019-10-16
        • 1970-01-01
        • 2020-09-11
        相关资源
        最近更新 更多