solc-js icon indicating copy to clipboard operation
solc-js copied to clipboard

Object prototype may only be an Object or null error on Webpack

Open jinhongkuan opened this issue 3 years ago • 0 comments

by adding the following line:

const solc = require('solc');

in my App.js file, I get the error below when loading the page. I believe this could be caused by webpack 5, since polyfills are involved, but not sure how to fix it. I appreciate any help thanks.

bundle.js:8701 Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at Function.setPrototypeOf (<anonymous>)
    at eval (polyfills.js:140)
    at patch (polyfills.js:142)
    at patch (graceful-fs.js:105)
    at eval (graceful-fs.js:97)
    at Object../node_modules/gulp-sourcemaps/node_modules/graceful-fs/graceful-fs.js (bundle.js:3436)
    at __webpack_require__ (bundle.js:8698)
    at fn (bundle.js:8936)
    at eval (index.internals.js:10)
    at Object../node_modules/gulp-sourcemaps/src/init/index.internals.js (bundle.js:3488)
eval @ polyfills.js:140
patch @ polyfills.js:142
patch @ graceful-fs.js:105
eval @ graceful-fs.js:97
./node_modules/gulp-sourcemaps/node_modules/graceful-fs/graceful-fs.js @ bundle.js:3436
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.internals.js:10
./node_modules/gulp-sourcemaps/src/init/index.internals.js @ bundle.js:3488
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:10
./node_modules/gulp-sourcemaps/src/init/index.js @ bundle.js:3499
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:4
./node_modules/gulp-sourcemaps/index.js @ bundle.js:3324
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:8
./node_modules/vinyl-fs/lib/src/index.js @ bundle.js:7078
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:4
./node_modules/vinyl-fs/index.js @ bundle.js:6902
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:25
./node_modules/module/dist/index.js @ bundle.js:4497
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:4
./node_modules/require-from-string/index.js @ bundle.js:5656
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ wrapper.js:3
./node_modules/solc/wrapper.js @ bundle.js:5955
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:1
./node_modules/solc/index.js @ bundle.js:5915
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ App.js:51
./src/App.js @ bundle.js:878
__webpack_require__ @ bundle.js:8698
fn @ bundle.js:8936
eval @ index.js:5
./src/index.js @ bundle.js:900
__webpack_require__ @ bundle.js:8698
(anonymous) @ bundle.js:9830
(anonymous) @ bundle.js:9833
Show 22 more frames

jinhongkuan avatar Apr 05 '21 21:04 jinhongkuan