我在学习reactjs我从安装nodejs开始,然后在我的项目文件夹“React”中运行这些命令
npx create-react-app hello-world
cd hello-world
npm start
但我没有转到浏览器,而是收到错误:
npm错误!缺少脚本:start
npm错误!此运行的完整日志可在:npm errbr>c:usersabcappdataroamingnpm-cache_logs2020-02-21t13_34_26_640z-debug.log中找到
package.json代码:
{
"name": "hello-world",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.4.0"
}
}
帮我解决这个错误我不想让它削弱我学习的动力
npm错误!缺少脚本:start
编辑
{
"name": "hello-world",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build"
},
"dependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.4.0"
}
}
我也面临着几乎相同类型的问题。但后来尝试了
在power shell中使用admin权限,这似乎可以解决这个问题。
此外,您还需要在您的机器上安装Node>=8.10,yarn>=0.25+,正如官方文档所建议的那样。