ReactJS+NodeJS:什么是错误"传递--update binary以重新安装或--build fro

ReactJS + NodeJS: What is error "Pass --update-binary to reinstall or --build-from-source to recompile"?

本文关键字:binary --update 重新安装 fro --build 传递 什么 错误 quot ReactJS+NodeJS      更新时间:2023-09-26

我将ReactJS+NodeJS项目从另一台计算机转移到了一台新计算机上。然后在文件夹中,我在终端中执行了npm install,但得到了以下响应。

> fsevents@1.0.14 install /Users/Joshua/Projects/practice_project/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/Joshua/Projects/practice_project/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

在以前的计算机上,我通过npm run server运行该项目,但当我在新计算机上的项目中npm run server之后执行时,现在我得到:

> practice_project@1.0.0 serve /Users/Joshua/Projects/practice_project
> nodemon server/server.js --ignore components
sh: nodemon: command not found
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "serve"
npm ERR! node v4.6.1
npm ERR! npm  v2.15.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! practice_project@1.0.0 serve: `nodemon server/server.js --ignore components`
npm ERR! spawn ENOENT

我环顾四周,但似乎找不到正确的解决方案。尝试了npm install -g node-gyp,但得到了tar.unpack untar error

可能是什么问题?将投赞成票并接受答案。非常感谢。

在这种情况下,您收到的第一条消息只是告诉您,它正在尝试为您的环境重新构建fsevents包,然后意识到它已经构建好了,因此停止了该过程。

第二条消息表示您正在尝试运行nodemon,但尚未安装。我大胆猜测,它是全局安装在您以前的机器上的(因此不包括在项目的package.json中(。如果您想再次全局安装它,则需要运行npm i -g nodemon