ReactJS + NodeJS:什么是错误 "Pass --update-binary to reinstall or --build-from-source to recompile"?

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

我运行将 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.