【问题标题】:react-scripts missing after install redux安装 redux 后缺少反应脚本
【发布时间】:2018-07-28 08:54:13
【问题描述】:

我根据此处描述的步骤创建了反应应用程序https://www.sitepoint.com/getting-started-react-beginners-guide/

npm i -g create-react-app
create-react-app myapp
yarn start

一切正常,所以我尝试按照此处所述安装 redux https://redux.js.org/docs/basics/UsageWithReact.html

npm install --save react-redux

我收到了这条消息

  • react-redux@5.0.7 在 14.541 秒内添加了 3 个包,删除了 1061 个包并更新了 18 个包

现在当我尝试时

yarn start

我收到消息

yarn run v1.3.2
$ react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

怎么了?我不明白为什么 react-scripts 不起作用。我以为 --save 将第三方包添加到包的依赖项中,与其他包无关。 我感谢每一个建议我做错了什么以及如何解决它。 谢谢

【问题讨论】:

    标签: reactjs npm redux installation


    【解决方案1】:

    您应该使用yarn 安装redux package 而不是npm install --save react-redux

    yarn add redux

    问题:

    您正在使用yarn 包管理器创建应用程序,然后使用npm 添加新包,从而导致弹出使用纱线安装的包。 因为这个react-scripts 得到删除抛出错误。

    【讨论】:

    • 感谢您的回答。我用 npm install 重新创建丢失的包它解决了我的问题。
    猜你喜欢
    • 2019-09-19
    • 1970-01-01
    • 2023-03-11
    • 2020-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-22
    • 1970-01-01
    相关资源
    最近更新 更多