我刚刚开始对 codepen 做出反应,我真的很喜欢它!我决定将它安装在我的 MacBook Air 上。我使用 npm 安装了 create-react-app,一切看起来都不错。然后我开始了一个项目,一切都很顺利。当我运行时npm start,出现错误:
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! react-app@0.1.0 start: 'react-scripts start'
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the react-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)
我得出的结论是 npm 找不到 react-scripts。我已经完成了几乎所有我想出的事情:我已经更新了 npm;我已经重新安装了模块;我已经开始了一个新项目,但我仍然遇到同样的错误。我检查过,react-scripts 在我的 node_modules 文件中。我唯一没有做的是全局安装 react-scripts,但是 create-react-app …
正如标题所说,我试图在本地主机上执行一个 PHP 文件,但它只是下载该文件。我正在使用 npm 包 http-server。我曾尝试使用 python 中的 SimpleHTTPServer,但它做同样的事情。
我正在运行 MacOS Mojave。我该怎么办?