【发布时间】:2018-05-30 06:48:58
【问题描述】:
我使用 create-react-app 来生成一个应用程序。
create-react-app myapp
当我运行 yarn start 或 npm start 时出现此错误:
react-scripts 开始
sh: react-scripts: command not found npm ERR!文件 sh npm 错误!代码 生命周期 npm 错误! errno ENOENT npm 错误!系统调用产生 npm 错误! myapp@0.1.0 开始:
react-scripts startnpm 错误!生成 ENOENT npm 呃! npm 错误!在 myapp@0.1.0 启动脚本中失败。 npm 错误!这 可能不是 npm 的问题。可能有额外的日志记录 上面的输出。
当我运行 npm ls react:
myapp@0.1.0 /Users/johnno/foosball
└── react@16.2.0
存在反应脚本。
这是我的 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 的建议,但无济于事。我该如何解决这个问题?
【问题讨论】:
-
我们能看到你运行的所有命令吗?
-
见上文更新问题
-
您使用的是哪个版本的节点?你试过
sudo npm start吗? -
节点版本 5.0.3
-
sudo npm start 没有区别
标签: macos reactjs create-react-app yarnpkg