我刚得到一个供个人使用的 Mac Mini M1,我正在尝试运行一个预先存在的 React 应用程序。我成功安装了nodejs和npm,据我所知,运行npm install
确实正确添加了node_modules
文件夹;但是每当我运行npm start
or时npm run <script>
,我都会收到错误消息。似乎 npm 无法访问该项目的任何依赖项。我也使用 Rosetta 终端进行了尝试,结果相同。
例如,我用 初始化了一个新的 React 项目npx create-react-app test_app
,然后cd
编辑到它并运行npm start
. 我有:
test_repo@0.1.0 start
> react-scripts start
sh: react-scripts: command not found
如何让这些命令正常运行并启动应用程序?
这是我用于节点和 npm 的内容:
➜ test_repo npm -v
7.6.0
➜ test_repo node -v
v15.11.0