【发布时间】:2020-08-07 14:52:10
【问题描述】:
我升级了节点并构建了现有文件。
但它没有构建,并且出现错误。
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: │
│ ~~/nuxt.config.js │
│ require() of ES modules is not supported. │
│ require() of ~~/nuxt.config.js from │
│ ~~/config.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 nuxt.config.js to end in .cjs, change the requiring code to use │
│ import(), or remove "type": "module" from │
│ ~~/package.json.
所以我删除了 package.json 文件中的 'type: module'。
可以去掉吗?
【问题讨论】: