本文介绍了NodeJS [DEP0097]弃用警告:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能帮我解决这个错误吗?

Can you help me with this error?

代码是

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.

这是运行时遇到的特定节点v10问题. 我不知道弃用在何处显示,但大多数情况下是在异步/等待和承诺代码上.

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]弃用警告:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 09:12