Error when starting caused by plugins.
See original GitHub issueI can not start with npm run vite
, the console output is like:
> node ./bin/vite
running: vite --config X:\A\src\node_modules\_vue-cli-plugin-vite@1.0.0-rc.3@vue-cli-plugin-vite\config\index.ts
error when starting dev server:
TypeError: Cannot read property 'apply' of undefined
at X:\A\src\node_modules\_vite@2.0.5@vite\dist\node\chunks\dep-e0f09032.js:48165:19
at Array.filter (<anonymous>)
at resolveConfig (X:\A\src\node_modules\_vite@2.0.5@vite\dist\node\chunks\dep-e0f09032.js:48164:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async createServer (X:\A\src\node_modules\_vite@2.0.5@vite\dist\node\chunks\dep-e0f09032.js:68144:20)
at async CAC.<anonymous> (X:\A\src\node_modules\_vite@2.0.5@vite\dist\node\cli.js:14027:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mjapp@2.5.0 vite: `node ./bin/vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mjapp@2.5.0 vite 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! D:\Programs\nodejs\global\cache\_logs\2021-04-19T17_08_49_381Z-debug.log
By looking at the ts codes, it is caused by these lines in node_modules\_vue-cli-plugin-vite@1.0.0-rc.3@vue-cli-plugin-vite\config\index.ts
line 45-48:
export default defineConfig({
plugins: [
envCompatible(),
// auto infer pages
htmlTemplate({ pages: vueConfig.pages || {} }),
vueCli(),
createVuePlugin(viteOptions.vitePluginVue2Options),
useMPA
? mpa()
: undefined,
...extraPlugins,
],
optimizeDeps: viteOptions.optimizeDeps,
})
When this is not mpa, it will add an undefined to plugins
for user config. Thus, the flat().filter()
won’t deal it properly because it can not access plugins
for undefined
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
WordPress Plugin Troubleshooting: What To Do When Your ...
Go to the Plugins page. · Click the Deactivate link associated with the plugin causing the issue. · Check your site. · If...
Read more >Confluence plugins have version errors on start up ... - Jira
Often, on startup or on Add-on update Confluence has errors with Add-Ons that have versions that clash with each other. This often causes...
Read more >How to Fix the "There Has Been a Critical Error on Your ...
Luckily, fixing this critical error is usually just a matter of adding a small PHP function or deleting a problem plugin. Here we'll...
Read more >Solve Problems With Plugins – WordPress.com Support
Check if the issue still exists. If the error is no longer present, the plugin(s) you deactivated was causing the conflict. Determine which...
Read more >Troubleshooting 101: Plugin Causing Fatal Error
Troubleshooting 101: Plugin Causing Fatal Error · Pinpoint the Error · Log in to your site via FTP · Rename the conflicting plugin...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I changed the
vite
tonpx vite
in cross-spawn, and it works. Thanks.maybe in bin/vite use npx vite instead of vite directly? try it