NodeJS [DEP0097] 弃用警告: [英] NodeJS [DEP0097] DeprecationWarning:
问题描述
你能帮我解决这个错误吗?
Can you help me with this error?
(node:6692) [DEP0097] DeprecationWarning: Using a domain property in不推荐使用 MakeCallback.使用 async_context 变体改用 MakeCallback 或 AsyncResource 类.未处理的拒绝插件webpack-stream"中的错误
(node:6692) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context v ariant of MakeCallback or the AsyncResource class instead. Unhandled rejection Error in plugin "webpack-stream"
代码是
import gulp from 'gulp';
import yargs from 'yargs';
import sass from 'gulp-sass';
import cleanCSS from 'gulp-clean-css';
import gulpif from 'gulp-if';
import sourcemaps from 'gulp-sourcemaps';
import imagemin from 'gulp-imagemin';
import del from 'del';
import webpack from 'webpack-stream';
export const scripts = () => {
return gulp.src(paths.scripts.src)
.pipe(webpack({
module: {
rules: [{
test: /.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}]
},
output : {
filename: 'bundle.js'
}
}))
.pipe(gulp.dest(paths.scripts.dest));
}
并来自 package.json:
and from package.json:
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"del": "^4.1.1",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.2.0",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^6.0.0",
"gulp-sass": "^4.0.2",
"gulp-sourcemaps": "^2.6.5",
"node-sass": "^4.12.0",
"webpack": "^4.32.2",
"webpack-stream": "^5.2.1",
"yargs": "^13.2.4"
}
我应该升级/添加什么?
what should I upgrade/add?
推荐答案
我的朋友让我解决这个问题,但我无法用我的系统重新生成这个问题.
My friend asks me to solve this problem but I can't regenerate this problem with my system.
直到我找到这个文档
DEP0097: MakeCallback with domain property#
node v10.0.0
Runtime deprecation.
Type: Runtime
Users of MakeCallback that add the domain property to carry context, should start
using the async_context variant of MakeCallback or CallbackScope, or the
high-level AsyncResource class.
然后通过升级和降级更改节点版本后,它工作正常,没有错误.
Then After change node version by the upgrade and downgrade it working fine no error got.
这是运行时特定的 node v10 问题.我不知道从哪里弃用,但大多数时候它是在 async/await 和 promise 代码上.
It is a specific node v10 problem at runtime. I don't have any idea from where deprecation show but most of the time it is on async/await and promise code.
这篇关于NodeJS [DEP0097] 弃用警告:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!