node.js - 安装react时npm启动问题,如何解决?

使用'npm install -g create-react-app'安装 Node 和全局create-react-app后,我开始使用'npx(或npm我都试过)create-react-app appname'创建我的第一个应用程序已成功创建,直到我在“appname”目录中启动“npm start”,这给了我以下错误。

E:\Sang\React\myapp>npm 开始

myapp@0.1.0 start E:\Sang\React\myapp react-scripts-start

'react-scripts-start' 不被识别为内部或外部命令, 可运行的程序或批处理文件。
错误!代码生命周期
错误!错误号 1
错误! myapp@0.1.0 开始:react-scripts-start
错误!退出状态 1
npm 错误!
错误! myapp@0.1.0 启动脚本失败。
错误!这可能不是 npm 的问题。上面可能有额外的日志输出。

npm 错误!可以在以下位置找到此运行的完整日志: 错误! C:\Users\桑通星\AppData\Roaming\npm-cache_logs\2020-09-03T12_06_34_133Z-debug.log

这是我在 package.json 中的脚本代码

{
"name": "myfirstreact",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3"
},
"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"
]
}
}

请帮助我解决我的问题,我正计划使用 React 构建自己的网站。非常感谢你

最佳答案

"scripts":{
"start":"react-scripts-start",
"build":"react-scripts-build",
"test":"react-scripts-test",
"eject":"react-scripts-eject",
}

您必须转到 package.json 文件并查看脚本内部, 你应该看到有启动脚本。如果您没有添加它。

https://stackoverflow.com/questions/63722991/

相关文章:

python - 使用最佳学习率导致随机猜测的准确性

python - 雪花 Python Okta 连接

tensorflow - 如何将 tf.data.Dataset 与 kedro 一起使用?

python - 如何一次对每一行进行不同的 tensorflow 张量切片?

stripe-payments - Stripe Checkout session 后如何在发票上获

android - 分享内容 : Permission Denial when using Inte

json - 使用 JSON Body on Rule 调用 REST API Business C

r - 如何使用 igraph R 包比较两个图以识别两个图之间相同/不同边的数量

java - .rsaEncryptionOAEPSHA256算法在iOS上与Java的兼容性

firebase - 如何在 flutter 中捕获 StorageException