当前位置: 首页 > 面试题库 >

在npm中找不到nodemon

许远航
2023-03-14
问题内容

我有一个问题: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
> aaa@0.0.1 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! aaa@0.0.1 start: `nodemon server.js`
npm ERR! Exit status 127
npm ERR! 
npm ERR! Failed at the aaa@0.0.1 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-dev

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

已添加,--save-dev因为仅在开发期间才需要。



 类似资料:
  • 问题内容: 我正在尝试安装一些示例的依赖项:我已经下载了npm ,但是所有应用程序都抛出相同的错误: 堵塞似乎是: 没有这样的文件或目录’c:\ node \ stylus \ package.json 我是否错过了创建的步骤? 我在run: Windows 7 64位 npm 1.1.1 node6.11 express2.5.8 问题答案: 更新2018 这已成为一个很受欢迎的问题,我的回答(

  • 在这个linux服务器上,我有一个名为“myuser”的用户。对于此用户,在回显路径时,我得到这个: /home/myuser/bin:/home/myuser/.local/bin:/home/myuser/.nvm/versions/node/v6.11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/us

  • 当我尝试安装npm与,我得到以下错误: E:找不到包npm 为什么找不到npm?我正在使用Debian 9并且已经运行了

  • 问题内容: 通常,我可以使用 npm 安装库,但是今天在安装yeoman时遇到了此错误。请帮助找出根本原因。 我查看了文件夹: C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ 但看不到 node_modules 文件夹作为描述的错误。 我也尝试找到 npm-cli.js 并查看它实际上在 问题答案: 事实证明,问题出在系统变量中节点的

  • 我使用的是Debian9.3。(拉伸)我无法运行“npm”命令。 节点-v的输出 nodejs-v的输出 输出为 我是Debian的新手,我不知道发生了什么 -我已重新安装节点。js -我已经试着按照官方页面的步骤操作了 -我已经运行了Output -我在Debian测试,在那里时也有同样的错误。 感谢阅读和帮助 -Melt

  • 问题内容: 所以我想安装 https://www.npmjs.com/package/@progress/kendo-react- grid 该软件包存在于网站上,但是当我运行命令时 我收到404错误 想法? 到目前为止,我认为用户范围是什么 第二次尝试 问题答案: 我看着我的,这就是里面的东西 与该用于评论查看文档 我注释掉了所有4行,并且能够运行 无论出于何种原因,我都没有在https://w