ReactJS + NodeJS:什么是错误“通过--update-binary重新安装或--build-from-source重新编译”?

Wal*_*ter 5 javascript node.js npm reactjs npm-install

我将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
Run Code Online (Sandbox Code Playgroud)

在以前的计算机上,我通过来运行项目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
Run Code Online (Sandbox Code Playgroud)

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

可能是什么问题?将投票并接受答案。谢谢。

Dav*_*e V 3

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

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