gpt4 book ai didi

macos - 如何解决sh : react-scripts: command not found?

转载 作者:行者123 更新时间:2023-12-04 12:01:22 30 4
gpt4 key购买 nike

我使用 create-react-app 来生成一个应用程序。

create-react-app myapp

当我运行 yarn start 或 npm start 时,出现此错误:

react-scripts start



sh:react-scripts:找不到命令 npm ERR!文件 sh npm 错误!代码
ELIFECYCLE npm 错误! errno ENOENT npm 错误!系统调用产生 npm ERR!
myapp@0.1.0 开始: react-scripts start npm 错误!生成 ENOENT npm
呃! npm 错误!在 myapp@0.1.0 启动脚本失败。 npm 错误!这个
可能不是 npm 的问题。可能有额外的日志记录
上面的输出。

当我运行 npm ls 时 react :
myapp@0.1.0 /Users/johnno/foosball 
└── react@16.2.0

react 脚本存在。

这是我的 package.json:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-scripts": "1.0.17",
"redux": "^3.7.2",
"yarn": "^1.3.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}

我尝试了来自 this 的建议但无济于事。我该如何解决这个问题?

最佳答案

我通过删除解决了这个问题

node_modules
yarn.lock
manifest_lock.json



并通过安装包
npm install

或者
yarn

关于macos - 如何解决sh : react-scripts: command not found?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47842849/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com