当前位置:   article > 正文

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: E:\works\large-file-uploader\node_module

must use import to load es module:

 使用npm run dev启动vite项目报错:

  1. > vite
  2. internal/modules/cjs/loader.js:1174
  3. throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
  4. ^
  5. Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: E:\works\large-file-uploader\node_modules\vite\bin\vite.js
  6. at Object.Module._extensions..js (internal/modules/cjs/loader.js:1174:13)
  7. at Module.load (internal/modules/cjs/loader.js:1002:32)
  8. at Function.Module._load (internal/modules/cjs/loader.js:901:14)
  9. at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
  10. at internal/main/run_main_module.js:18:47 {
  11. code: 'ERR_REQUIRE_ESM'
  12. }
  13. npm ERR! code ELIFECYCLE
  14. npm ERR! errno 1
  15. npm ERR! large-file-uploader@0.0.0 dev: `vite`
  16. npm ERR! Exit status 1
  17. npm ERR!
  18. npm ERR! Failed at the large-file-uploader@0.0.0 dev script.
  19. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  20. npm ERR! A complete log of this run can be found in:
  21. npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2023-08-15T09_13_59_734Z-debug.log

原因:nodejs版本太低

vue3+vite项目需要使用nodejs16及以上版本才能正常运行,修改nodejs版本后成功启动

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/550910
推荐阅读
相关标签
  

闽ICP备14008679号