最新版本的 Node.js 上的最新版本的 Nodemon 会导致在启动时记录弃用警告。
这与 Nodemon 而不是我的启动脚本有关,因为当我直接运行npm start
(不是通过 Nodemon)时,不会记录弃用警告。
nodemon -v
:1.18.5node -v
:11.0.0{
"watch": "nodemon",
"start": "node --experimental-modules --no-warnings -r dotenv/config server"
}
npm run watch
md5-5c7f483fc44346d27a37182ef5f13bdb
[DEP0106] DeprecationWarning: crypto.createDecipher is deprecated.
使用上面指定的 Nodemon 和 Node.js 版本。
如果适用,请在您的命令上附加--dump
标志并在此处包含输出,以确保删除任何敏感/个人详细信息或标记。
我尝试将--trace-deprecations
添加到我的启动脚本中,但它没有效果,因为弃用警告是由在启动脚本之前运行的 Nodemon 代码(或依赖项)触发的。
如果您尝试使用裸 index.js 的 nodemon,您还会收到警告吗?
IE。
echo "" > index.js
nodemon index.js
是的:
确实,我也遇到了这个问题。
node index.js
=> 没有警告
nodemon index.js
=> 收到警告
同样的问题,
nodemon
版本:1.18.6
这是跟踪:
> nodemon index.js
(node:27294) [DEP0106] DeprecationWarning: crypto.createDecipher is deprecated.
at [redacted]/node_modules/flatmap-stream/index.min.js:1:1264
at Object.<anonymous> ([redacted]/node_modules/flatmap-stream/index.min.js:1:1423)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
at Module.require (internal/modules/cjs/loader.js:643:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> ([redacted]/node_modules/event-stream/index.js:11:15)
它绕了一圈……原来是某种注入攻击。
https://github.com/dominictarr/event-stream/issues/116
相关: https ://github.com/remy/nodemon/issues/1451
我试图在 nodemon 上发布一个版本,但测试没有通过(其中一个集成测试是让后台服务器运行)。
也就是说,全新安装的 nodemon 应该引入[email protected]
,如果它导致了这个警告,现在应该是干净的。
有人可以测试(并针对 nodemon install diff 用npm ls pstree.remy
确认)吗?
pstree.remy
版本已解决此问题; 受感染的软件包已从nodemon
依赖树中删除。 谢谢!
我试图在 nodemon 上发布一个版本,但测试没有通过(其中一个集成测试是让后台服务器运行)。
@remy很高兴听到您的测试失败,事情肯定是坏了。 参见#1464。
@FallingSnow纯粹出于好奇:从堆栈跟踪开始,您是如何发现它是注入攻击的? 你开始分析 js 和 min.js 文件了吗?
这是跟踪:
```js
nodemon index.js
(节点:27294)[DEP0106] DeprecationWarning:crypto.createDecipher 已弃用。
在 [已编辑]/node_modules/flatmap-stream/index.min.js:1:1264
在对象。([编辑]/node_modules/flatmap-stream/index.min.js:1:1423)
...
@piotrturski如果您有该堆栈跟踪,您的依赖项已过时并且 nodemon 需要升级。
@piotrturski我只是跟踪堆栈跟踪,直到遇到一些看起来像经过混淆的有效负载的非常奇怪的代码。
所以是的,我确实分析了 js 文件,请参阅https://github.com/dominictarr/event-stream/issues/116。
最有用的评论
它绕了一圈……原来是某种注入攻击。
https://github.com/dominictarr/event-stream/issues/116
相关: https ://github.com/remy/nodemon/issues/1451