最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

在npm中找不到nodemon

运维笔记admin13浏览0评论

在npm中找不到nodemon

在npm中找不到nodemon

我有一个问题:nodemon没有运行npm脚本(例如npm start), 但是如果在npm脚本之外的命令行上调用nodemon,则nodemon将正常运行。

$ nodemon server.js
14 Feb 22:59:51 - [nodemon] v1.3.7
14 Feb 22:59:51 - [nodemon] to restart at any time, enter `rs`
14 Feb 22:59:51 - [nodemon] watching: *.*
14 Feb 22:59:51 - [nodemon] starting `node server.js`

如何在npm脚本中调用它:

package.json

{
...
  "scripts": {
    "start": "nodemon server.js"
  }
}

当运行npm start脚本时:

$ npm start
> [email protected] start /home/akul/Documents/aaa
> nodemon server.js

sh: 1: nodemon: not found

npm ERR! Linux 3.13.0-45-generic
npm ERR! argv "node" "/home/akul/npm-global/bin/npm" "start"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `nodemon server.js`
npm ERR! Exit status 127
npm ERR! 
npm ERR! Failed at the [email protected] start script 'nodemon server.js'.
npm ERR! This is most likely a problem with the aaa package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nodemon server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls aaa
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/akul/Documents/aaa/npm-debug.log

我一直在寻找解决方案,但还没有找到解决方案。

回答如下:

您可以通过将nodemon添加到package.json来解决此问题

npm install nodemon --save

在/node_modules/.bin中不存在nodemon时会发生此问题

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论