From the error message it sounds like you need to convert the CommonJS style (require) to the ES6 style using imports instead of require
gulp failing after Laravel 10 upgrage
We have just upgraded our Application to Laravel 10:
const VERSION = '10.32.1';
We are on ubuntu 22.04 LTS and have installed gulp: node v12.22.9 npm 8.5.1 gulp CLI version: 3.0.0 (Local version: Unknown)
However, when I attempt to reload all the assets I get:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /var/www/html/leafhopper/solar3/node_modules/del/index.js require() of ES modules is not supported. require() of /var/www/html/leafhopper/solar3/node_modules/del/index.js from /var/www/html/leafhopper/solar3/gulpfile.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /var/www/html/leafhopper/solar3/node_modules/del/package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1015:13)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/var/www/html/leafhopper/solar3/gulpfile.js:2:11)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14) {
code: 'ERR_REQUIRE_ESM' }
It was so straight forward to load gulp on the previous Laravel 5.3 version of our Application (running gulp perfectly happily right now on another ubuntu box).
I'm wondering what's hit me. Does anyone know?
Please or to participate in this conversation.