赞
踩
使用npm run dev启动vite项目报错:
- > vite
-
- internal/modules/cjs/loader.js:1174
- throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
- ^
-
- Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: E:\works\large-file-uploader\node_modules\vite\bin\vite.js
- at Object.Module._extensions..js (internal/modules/cjs/loader.js:1174:13)
- at Module.load (internal/modules/cjs/loader.js:1002:32)
- at Function.Module._load (internal/modules/cjs/loader.js:901:14)
- at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
- at internal/main/run_main_module.js:18:47 {
- code: 'ERR_REQUIRE_ESM'
- }
- npm ERR! code ELIFECYCLE
- npm ERR! errno 1
- npm ERR! large-file-uploader@0.0.0 dev: `vite`
- npm ERR! Exit status 1
- npm ERR!
- npm ERR! Failed at the large-file-uploader@0.0.0 dev script.
- npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
-
- npm ERR! A complete log of this run can be found in:
- npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2023-08-15T09_13_59_734Z-debug.log
原因:nodejs版本太低
vue3+vite项目需要使用nodejs16及以上版本才能正常运行,修改nodejs版本后成功启动
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。