NodeJS [DEP0097] DeprecationWarning:

吃可爱长大的小学妹 提交于 2020-08-22 11:55:53

问题


Can you help me with this error?

(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"

the codeis

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));
} 

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?


回答1:


My friend asks me to solve this problem but I can't regenerate this problem with my system.

Until I found this Doc

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.

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.




回答2:


This solution works. Use run option with below:

run{ skipUncaughtErrors: true }



来源:https://stackoverflow.com/questions/56440304/nodejs-dep0097-deprecationwarning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!