【问题标题】:Error while using npm start in react js after cd react-app在 cd react-app 之后在 react js 中使用 npm start 时出错
【发布时间】:2020-04-02 13:50:21
【问题描述】:

当我尝试在 vsCode 终端中使用 npm start 时,它给出了一个错误,我已将其放在上图中,正如您在图片中看到的那样,我的 package.json 中只有启动脚本。 有人可以帮帮我吗?

【问题讨论】:

  • 它没有在the NPM page 中暗示它有一个 CLI 脚本(不是所有的包都有 - 在./node_modules/.bin 中有什么东西吗?)并且this tutorial 建议从特定的@987654326 运行它@ 文件。我不清楚你为什么认为这会奏效。

标签: javascript node.js reactjs npm npm-start


【解决方案1】:

您在“脚本”中看到的任何内容都是当您键入 npm script keyword here 时将运行的内容。

npm start 在您的实例中 - 正在运行 server。这不是命令。

您需要做的是将值从server 更改为node server.jsnode your_file.js

祝你在学习冒险中好运。

【讨论】:

    【解决方案2】:

    如果您之前通过npm install -g create-react-app 全局安装了create-react-app,我建议您使用npm uninstall -g create-react-app 卸载该软件包,以确保npx 始终使用最新版本。

    然后删除完整目录 在你的命令行中运行

    npx create-react-app react-app
    cd react-app
    npm start 
    

    【讨论】:

      猜你喜欢
      • 2021-01-03
      • 2020-11-17
      • 1970-01-01
      • 2021-09-26
      • 2019-05-07
      • 1970-01-01
      • 2019-03-18
      • 2017-02-18
      • 1970-01-01
      相关资源
      最近更新 更多