命令“npm start”中的问题在第四个 tic-tac-toe@0.1.0 启动脚本中失败。 npm 错误!反应脚本:未找到
Posted
技术标签:
【中文标题】命令“npm start”中的问题在第四个 tic-tac-toe@0.1.0 启动脚本中失败。 npm 错误!反应脚本:未找到【英文标题】:Problem in the command "npm start" Failed at the fourth-tic-tac-toe@0.1.0 start script. npm ERR! react-scripts: not found 【发布时间】:2020-08-08 23:11:17 【问题描述】:我正在做一个基本的井字游戏。首先,我使用这些命令的
创建应用程序npx create-react-app my-app 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 只有一个依赖项安装后,当我尝试启动应用程序时出现错误
【问题讨论】:
你试过运行npm install
吗?不是npm install <package -name>
先生,我试过了,它工作,谢谢
【参考方案1】:
安装新版本的节点
npm install -g npm@latest
进入你的应用目录并使用这个命令
npm install react-scripts@2.1.8
它对我有用。
【讨论】:
以上是关于命令“npm start”中的问题在第四个 tic-tac-toe@0.1.0 启动脚本中失败。 npm 错误!反应脚本:未找到的主要内容,如果未能解决你的问题,请参考以下文章
有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?