Error: ENOENT: no such file or directory in Vue CLI 3
See original GitHub issueI’m getting the following error when trying to build:
Building for production...Error: ENOENT: no such file or directory, stat '/Users/me/Code/project/index.html'
Package: "prerender-spa-plugin": "^3.1.0"
File: vue.config.js
:
const PrerenderSPAPlugin = require('prerender-spa-plugin');
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer;
const path = require('path');
module.exports = {
configureWebpack: config => {
if (process.env.NODE_ENV !== 'production') return;
return {
plugins: [
new PrerenderSPAPlugin({
staticDir: path.join(__dirname),
routes: ['/'],
minify: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
decodeEntities: true,
keepClosingSlash: true,
sortAttributes: true,
},
renderer: new Renderer({
renderAfterDocumentEvent: 'render-event',
}),
}),
],
};
},
};
I don’t have any routes, only a single index.html page.
Also, when I run yarn build
and get that error, I try to kill the process in terminal but it keeps returning Building for production...
without anything happening, and I have to quit terminal for it to stop.
Edit: I’ve also tried adding staticDir: path.join(__dirname, './public')
but the build hangs without any errors.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9
Top Results From Across the Web
How to fix error " No such file or directory error" with vue-cli ...
I mean, after install vue-cli with npm i -g @vue/cli restart the terminal or update the source with something like: source ~/.bash_profile ...
Read more >Vue CLI project setup throws ENOENT: no such file or ...
I am trying to create a new Vue.js app and I am running the command: vue create client. Next I am selecting the...
Read more >How to fix error " No such file or directory error" with vue-cli ...
I mean, after install vue-cli with npm i -g @vue/cli restart the terminal or update the source with something like: source ~/.bash_profile (or...
Read more >Why is Vue 2.6 the default install when I do Npm Install?
As I am new to Vue, I am thinking why spend time with V2.3 tutorials when the V3.0 tuts ... Module build failed:...
Read more >vue/cli启动异常:ENOENT: no such file or directory, scandir
VueCli 启动报错:ENOENT: no such file or directory, scandir 'D:\Data\Project\VueProject\hello\node_modules\@vue\cli-plugin-eslint\locales'
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 FreeTop 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
Top GitHub Comments
That might be your issue then, the plugin is waiting for your app to fire a DOM event, so if your app isn’t doing that, it will hang.
The most basic solution would be to replace
renderAfterDocumentEvent: 'render-event'
withrenderAfterTime: 5000
or something like that. Not ideal, but should get you started.@JoshTheDerf thanks, for me, i had to add
data-server-rendered="true"
in my<div id="app" data-server-rendered="true"></div>
and