簡體   English   中英

命令“npm start”中的問題在第四個 tic-tac-toe@0.1.0 啟動腳本中失敗。 npm ERR:反應腳本:未找到

[英]Problem in the command "npm start" Failed at the fourth-tic-tac-toe@0.1.0 start script. npm ERR! react-scripts: not found

我正在做一個基本的井字游戲。 首先我使用這些命令創建應用程序

npx 創建反應應用程序我的應用程序
cd 我的應用程序
npm啟動

一開始它工作得很好,但是當我安裝了一些依賴項並再次使用命令npm start 啟動應用程序時,給我錯誤

shivam@shivam:~/Documents/Projects/React/fourth-tic-tac-toe$ npm start

> fourth-tic-tac-toe@0.1.0 start /home/shivam/Documents/Projects/React/fourth-tic-tac-toe
> react-scripts start

sh: 1: react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! fourth-tic-tac-toe@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the fourth-tic-tac-toe@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/shivam/.npm/_logs/2020-04-25T10_03_35_243Z-debug.log

我的package.json文件在這里

{
  "name": "fourth-tic-tac-toe",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "bootstrap": "^4.4.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-icons": "^3.10.0",
    "react-scripts": "3.4.1",
    "react-toastify": "^5.5.0",
    "reactstrap": "^8.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

和 npm 版本5.6.0

我用命令npm install dependency-name安裝了所有
並且只有一個依賴於npm install --save bootstrap
安裝后,當我嘗試啟動應用程序時給我錯誤

1.安裝新版本節點

npm install -g npm@latest

  1. Go 在您的應用程序目錄中並使用此命令 npm install react-scripts@2.1.8

它對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM