question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENOENT: no such file or directory, open '/dist/index.html'

See original GitHub issue
  • I’m submitting a …
- [x ] bug report
- [ ] feature request
- [ ] support request => Please do not submit a support request here, see note at the top of this template.

I was following one of the examples, and after running “node dist/server.js”, I’m getting this error

fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/dist/index.html'

index.html exists in the dist folder

  • Please tell us about your environment:
  • Angular version: 5.2.9
  • OS: [ Mac OS X ]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

8reactions
sertrahcommented, Oct 15, 2018

i replace this line:

const template = fs.readFileSync(path.join(__dirname, ‘.’, ‘dist’, ‘index.html’)).toString();

And works for me 😄

const template = fs.readFileSync(path.join(__dirname, join(DIST_FOLDER, ‘browser/index.html’))).toString();

1reaction
hbk899commented, Jul 20, 2019

const template = fs.readFileSync(path.join(__dirname, join(DIST_FOLDER, ‘browser/index.html’))).toString();

I applied this

const DIST_FOLDER = join(process.cwd(), 'dist');
const template = fs.readFileSync(path.join(__dirname, join(DIST_FOLDER, 'browser/index.html'))).toString();

and my error changed to this fs.js:114 throw err; ^

Error: ENOENT: no such file or directory, open ‘\C:\Users\Bilal Khalid\Desktop\Practice Codes\universal\dist\browser\index.html’

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: ENOENT: no such file or directory, open 'dist/index.html'
You incorrectly set the distFolder variable. The distFolder from server.ts must point to the files containing the client side app, ...
Read more >
Error: ENOENT: no such file or directory, open 'dist/index.html'
I am using Angular 9 and at a stage where I am thinking of dropping the idea of using angular universal at all....
Read more >
no such file or directory, stat '/public/main.html' at Error (native ...
HTML : Error: ENOENT : no such file or directory, stat '/public/main. html ' at Error (native) [ Gift : Animated Search Engine ......
Read more >
express error: enoent: no such file or directory, stat - You.com
I suspect that index.html was not copied to the output directory from where your code resolves the absolute path for res.sendFile(...) .
Read more >
Error: ENOENT: no such file or directory, stat '/opt/render ...
If you're not using our free tier, you can use the shell tab to look at the filesystem of what you've deployed to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found