关于vite项目启动时MODULE_NOT_FOUND的报错

在按照vite提供的初始化流程来操作,最后run dev的时候出现了这个报错

Error: No valid exports main found for '/Users/xxx/Documents/vite-test/node_modules/@rollup/pluginutils'
    at resolveExportsTarget (internal/modules/cjs/loader.js:622:9)
    at applyExports (internal/modules/cjs/loader.js:499:14)
    at resolveExports (internal/modules/cjs/loader.js:548:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:654:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1028:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/xxx/Documents/vite-test/node_modules/@rollup/plugin-node-resolve/dist/index.js:15:19)
    at Module._compile (internal/modules/cjs/loader.js:1139:30) {
  code: 'MODULE_NOT_FOUND'

凭着多年对node尿性的理解,估计是版本号的不对,果断升级到了目前最新的版本(14.4.0),再删掉node_module重装,果然问题就被解决了,具体是什么问题后续会去查找资料;

你可能感兴趣的:(vite,前端)