1
resposta

erro "BigInt not defined" ao executar npm start

O seguinte erro acontece ao executar npm start:

C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\webpack\lib\optimize\SplitChunksPlugin.js:770
                                        const ZERO = BigInt("0");
                                                     ^

ReferenceError: BigInt is not defined
    at compilation.hooks.optimizeChunks.tap.chunks (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\webpack\lib\optimize\SplitChunksPlugin.js:770:19)
    at Hook.eval [as call] (eval at create (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:25:16)
    at Hook.CALL_DELEGATE [as _call] (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\tapable\lib\Hook.js:14:14)      
    at Compilation.seal (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\webpack\lib\Compilation.js:2280:36)
    at compilation.finish.err (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\webpack\lib\Compiler.js:1056:20)       
    at hooks.finishModules.callAsync.err (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\webpack\lib\Compilation.js:2105:4)
    at eval (eval at create (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:29:1)
    at asyncLib.each.err (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\webpack\lib\FlagDependencyExportsPlugin.js:332:11)
    at C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\neo-async\async.js:2830:7
    at Object.each (C:\Users\carva\Desktop\repo\alura-cursos\spa-vanilla[progresso]\src\node_modules\neo-async\async.js:2857:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! src@1.0.0 start: `webpack --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the src@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\carva\AppData\Roaming\npm-cache\_logs\2021-02-16T20_02_19_527Z-debug.log

Meu arquivos:

//webpack.config.js
const path = require('path');

module.exports = {
    mode: "development",
    entry: "./src/components/listagem/listagem-cliente.js",
    output: {
        filename: "main.js",
        path: path.resolve(__dirname, "dist"),
        publicPath: 'dist'
    }
}
//package.json
{
  "name": "src",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "webpack-cli": "^4.5.0",
    "webpack": "^5.22.0"
  },
  "devDependencies": {},
  "scripts": {
    "start": "webpack --config webpack.config.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
1 resposta

Fala ai Lucio, tudo bem? Qual a versão do Node instalado e sendo utilizada na sua máquina? Tente atualizá-la para uma versão mais nova, talvez 10.x ou 12.x.

Espero ter ajudado.