javascript - nodemon 显示正在重新启动服务器,但在对文件进行更改时无法正常工作
问题描述
我正在使用该nodemon
软件包,但它没有重新启动服务器。它只显示“由于更改而重新启动”。但在 youtube 视频中,我看到它之后显示“服务器运行”状态。
就我而言,这没有显示出来。它只是显示“由于更改而重新启动”,当我在浏览器中查看时,我的工作也没有更新。
我阅读了很多相关的堆栈溢出问题,但没有一个对我有帮助......在我的项目中本地安装它们作为 devdependent.noting 也不起作用。
我还尝试更改package.json
文件中的脚本标签。
在跑步时,我使用了nodemon
, npm start
, nodemon app.js
, nodemon lib/dev-server.js --delay 1
,nodemon -L
等等,但没有任何帮助。
==================================================== ================================ 编辑问题:
我正在使用 vs 代码。尝试使用 express 框架运行我的 javascript 代码。我正在使用 git bash 终端。任何基本的 hello world 代码也不能与 nodemon 一起运行。我遵循的步骤:
node -v
并且npm -v
正在我的 bash 终端上工作。我创建了一个基本的 hello world express 应用程序。使用npm init
npm install express --save
我附上了这个testApp的github存储库https://github.com/webdevshiv/testApp.git
然后主要问题是关于nodemon ..安装nodemon:,npm install nodemon --save-dev
也在nodemon install -g
脚本标签中:"scripts": { "start": "node app.js" },
运行nodemon的代码:nodemon app.js
在我的终端中运行这是我得到的:(bash:nodemon:找不到命令)
但是node app.js
正在工作....然后使用npx nodemon app.js
它正在显示-----
([nodemon] 2.0.4 [nodemon] to restart at any time, enter
rs[nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,json [nodemon] starting
节点 app.js Example app listening at http://localhost:3000 [nodemon] restarting due to changes... [nodemon] restarting due to changes... [nodemon] restarting due to changes... [nodemon] restarting due to changes.)
您可以在第一次监听端口时清楚地看到,但在下次我进行任何更改时,它会显示重新启动。但没有重新启动..在我发布这个之前,这是nodemon
正常使用的情况,但现在nodemon
无法正常工作......
我正在附加我的系统环境变量路径:C:\Program Files\MongoDB\Server\4.2\bin;C:\Program Files\Git\cmd; C:\Program Files\nodejs; C:\Program Files\nodejs\node_modules\npm
我正在为我的 vs 代码屏幕截图提供链接https://imgur.com/e6ViUaF https://imgur.com/eWOkG0V
解决方案
$npm ls chokidar
在您安装了 nodemon 的目录中运行上述命令。这对我有用。
推荐阅读
- dataweave - mule 4 文件名模式
- html - 如何在 URL 路径的末尾添加“/”符号?
- javascript - “rollup-plugin-svelte”以下包没有导出它们的`package.json`
- azure-ad-b2c - 使用 azure b2c 对 blazor 服务器项目进行安全且经过验证的登录?
- ffmpeg - ffmpegpalettgen rgb565可能吗?
- java - 如何在junit 5中模拟HttpClient的发送方法?
- javascript - 导入在 Next.JS 项目中分叉和编辑的包时出错
- matlab - Matlab 背景颜色图
- c# - C# 全部继承自公共类的类列表
- amazon-web-services - 使用胶水(Python/Pyspark)通过配置文件循环从源到s3的多个表?