当前位置: 首页 > 知识库问答 >
问题:

create-react-app的npm启动错误

姜振濂
2023-03-14

我有一个项目我两个星期没碰过。我收回它,现在当我尝试运行npm start时,我得到了这个错误。

> react-scripts start

sh: react-scripts: command not found

npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! UpScore@0.6.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the UpScore@0.6.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the UpScore package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs UpScore
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls UpScore
npm ERR! There is likely additional logging output above.
  • 节点6.7.0
  • NPM 3.10.3
  • Mac sierra 10.12

package.json

{
  "name": "UpScore",
  "version": "0.6.0",
  "private": true,
  "devDependencies": {
    "react-addons-test-utils": "^15.3.1",
    "react-scripts": "0.4.1",
    "react-test-renderer": "^15.3.1",
    "redux-logger": "^2.6.1"
  },
  "dependencies": {
    "@yoshokatana/medium-button": "^1.1.0",
    "axios": "^0.14.0",
    "bcrypt": "^0.8.7",
    "bcrypt-nodejs": "0.0.3",
    "bcryptjs": "^2.3.0",
    "body-parser": "^1.15.2",
    "connect-flash": "^0.1.1",
    "cookie-parser": "^1.4.3",
    "draft-js": "^0.8.1",
    "draft-js-editor": "^1.7.2",
    "draft-js-export-html": "^0.4.0",
    "ejs": "^2.5.2",
    "email-verification": "^0.4.5",
    "express": "^4.14.0",
    "express-session": "^1.14.1",
    "flexboxgrid": "^6.3.1",
    "highlight.js": "^9.6.0",
    "immutable": "^3.8.1",
    "katex": "^0.6.0",
    "lodash": "^4.15.0",
    "markdown-it-mathjax": "^1.0.3",
    "material-ui": "^0.15.4",
    "medium-editor": "^5.22.0",
    "minutes-seconds-milliseconds": "^1.0.3",
    "moment": "^2.15.0",
    "moment-duration-format": "^1.3.0",
    "mongod": "^1.3.0",
    "mongodb": "^2.2.9",
    "mongoose": "^4.6.0",
    "monk": "^3.1.2",
    "morgan": "^1.7.0",
    "normalize.css": "^3.0.3",
    "passport": "^0.3.2",
    "passport-local": "^1.0.0",
    "react": "^15.3.1",
    "react-dom": "^15.3.1",
    "react-markdown": "^2.4.2",
    "react-medium-editor": "^1.8.1",
    "react-redux": "^4.4.5",
    "react-redux-form": "^0.14.5",
    "react-rich-markdown": "^1.0.1",
    "react-router": "^2.7.0",
    "react-router-redux": "^4.0.5",
    "react-tap-event-plugin": "^1.0.0",
    "react-tinymce": "^0.5.1",
    "redux": "^3.6.0",
    "redux-form": "^6.0.5",
    "redux-form-material-ui": "^4.0.1",
    "redux-promise-middleware": "^4.0.0",
    "redux-thunk": "^2.1.0",
    "reselect": "^2.5.3",
    "screenfull": "^3.0.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "start:prod": "pushstate-server build",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "server": "cd client/api && pm2 start server.js --watch",
    "proxy": "http://128.199.139.144:3000"
  },
  "eslintConfig": {
    "extends": "./node_modules/react-scripts/config/eslint.js"
  }
}

我试图克隆我的回购也得到同样的错误。如果有人能给我点办法找出发生了什么。谢谢。

共有1个答案

萧允晨
2023-03-14

Create React应用程序签入的作者。

您绝对不应该全局安装react-scripts
您也不需要package.json中的./node_modules/react-scripts/bin/

如果你看到这个:

npm ERR! UpScore@0.6.0 start: `react-scripts start`
npm ERR! spawn ENOENT

它只是意味着在第一次安装依赖项时出了问题。

我建议做这三个步骤:

    null

这应该可以解决这个问题。
如果没有,请将问题存档,并提供指向您的项目以及Node和NPM版本的链接。

 类似资料:
  • 问题内容: 我有一个项目,我两个星期都没碰过。我将其取回,现在尝试运行时出现此错误。 节点6.7.0 npm 3.10.3 mac sierra 10.12 package.json 我也尝试克隆我的存储库,并得到相同的错误。如果有人可以给我一些方法来查找发生了什么。谢谢 问题答案: 签入Create React App的作者。 您绝对不应该在全球范围内安装。 您还 没有 需要的是这个答案暗示。

  • 这是错误这是我在输入npm install-g create-react-app时得到的错误,机器人朋友是我应该创建的应用程序的名称Thanx提前为您提供帮助

  • npm启动 在默认浏览器上启动反应服务器,对我来说是Firefox。我喜欢Firefox用于浏览,但更喜欢其开发人员工具的Web开发Chrome。有没有办法强制"npm start"使用Chrome启动服务器,而不将我的默认浏览器更改为chrome?我在Windows上使用Bash。 编辑:我使用"create-react-app"来创建我的服务器,这为"npm start"添加了一个脚本到"pa

  • **Visual Studio 2019开发者命令提示符v16。4.0**版权所有(c)2019年微软公司 C:\Users\asdf\Desktop\scratch3\create react app\docusaurus\website @start C:\用户\asdf\桌面\划痕3\创建-反应-应用程序\docusaurn\网站docusauron启动 “docusaurus”不被识别为内

  • Create React App 不用配置就可以创建 React App。 全局安装: npm install -g create-react-app 创建 App: create-react-app my-appcd my-app/ 启动 npm: npm start 打开 http://localhost:3000/  查看你的 App。 如果你准备将其部署到生产环境,只需创建一个压缩包,并且运行 npm run build。

  • 问题内容: 如标题所示,我刚刚安装了react库,并第一次启动了该应用程序。我在下面收到以下错误。 据我所知,似乎该应用程序正在寻找错误的文件夹以查找启动脚本。我没有更改任何初始启动器文件,也没有添加任何我自己的文件。我不确定如何解决此问题。 问题答案: 我认为您忘记了进入(或更改为)项目的目录。 假设您已在目录中初始化了项目并指定了项目名称,只需键入(或者确切地说是在“命令提示符”中键入然后运行