When I run this command npm run dev after npm install and npm install gulp -g , the error happened as following. May I know how to solve?
C:\Users\admin\Desktop\Luckysheet>npm run dev
luckysheet@2.1.12 dev C:\Users\admin\Desktop\Luckysheet
cross-env NODE_ENV=development gulp dev
(node:4108) Warning: require() of ES modules is not supported.
require() of C:\Users\admin\Desktop\Luckysheet\node_modules\rollup\dist\es\rollu
p.browser.js from C:\Users\admin\Desktop\Luckysheet\gulpfile.js is an ES module
file as it is a .js file whose nearest parent package.json contains "type": "mod
ule" which defines all .js files in that package scope as ES modules.
Instead rename rollup.browser.js to end in .cjs, change the requiring code to us
e import(), or remove "type": "module" from C:\Users\admin\Desktop\Luckysheet\no
de_modules\rollup\dist\es\package.json.
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\admin\Deskt
op\Luckysheet\node_modules\rollup\dist\es\rollup.browser.js
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1163:13)
at Module.load (internal/modules/cjs/loader.js:983:32)
at Function.Module._load (internal/modules/cjs/loader.js:891:14)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\admin\Desktop\Luckysheet\gulpfile.js:22:20)
at Module._compile (internal/modules/cjs/loader.js:1128:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:983:32)
at Function.Module._load (internal/modules/cjs/loader.js:891:14) {
code: 'ERR_REQUIRE_ESM'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! luckysheet@2.1.12 dev: cross-env NODE_ENV=development gulp dev
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the luckysheet@2.1.12 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2021-01-14T12_20_24_
597Z-debug.log
C:\Users\admin\Desktop\Luckysheet>
1条答案
按热度按时间6ss1mwsb1#
Please try:
npm cache clean --force
npm i rimraf -g
rimraf node_modules
npm i
npm run dev