Bug: Error while serving </path/to/application/file> with content -type text/plain: ENOENT: no such file or directory, open '</path/to/application/file>'

3
closed
shivachettri
shivachettri
Posted 3 months ago

Bug: Error while serving </path/to/application/file> with content -type text/plain: ENOENT: no such file or directory, open '</path/to/application/file>' #23143

I built an react app that work perfecly fine in local system and also in server. However, following issues can be found in .pm2/logs/.log:

PM2 Error Log for React App:

9|static-p | [2022-01-16T20:46:39.807Z] Error while serving /var/www/html/we-pik/admin/build/consumers with content -type text/plain : ENOENT: no such file or directory, open '/var/www/html/we-pik/admin/build/consumers' 9|static-p | [2022-01-16T20:46:53.169Z] Error while serving /var/www/html/we-pik/admin/build/subscribed with conten t-type text/plain : ENOENT: no such file or directory, open '/var/www/html/we-pik/admin/build/subscribed' 9|static-p | [2022-01-16T20:47:00.857Z] Error while serving /var/www/html/we-pik/admin/build/blogs with content-typ e text/plain : ENOENT: no such file or directory, open '/var/www/html/we-pik/admin/build/blogs' 9|static-p | [2022-01-16T20:47:12.290Z] Error while serving /var/www/html/we-pik/admin/build/service-pricing with c ontent-type text/plain : ENOENT: no such file or directory, open '/var/www/html/we-pik/admin/build/service-pricing' s' 26|wepik-a | [2022-01-19T12:27:55.946Z] Error while serving /var/www/cdci/we-pik/we-pik/admin/build/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/var/www/cdci/we-pik/we-pik/admin/build/dashboar d' (...lot more lines line above)

Steps To Reproduce

It's a log from PM2 that is serving React App. However, I've not discovered any issue is using the application.

The Expected Bahaviour

Hope if anyone can guide me through to resolve this error logs from occuring. Don't want it to be causing trouble in future.

bvaughn
bvaughn
Created 3 months ago

This doesn't look like it has anything to do with React for what it's worth.

You'll probably have better luck asking on Stack Overflow.: https://stackoverflow.com/questions/

shivachettri
shivachettri
Created 3 months ago

This doesn't look like it has anything to do with React for what it's worth.

You'll probably have better luck asking on Stack Overflow.: https://stackoverflow.com/questions/

I felt the same, frankly, I did looked for the issue everywhere else, but not not find the solution.

The issue is - pm2 is serving the build file that it cannot locate and end up loggin error. This either has to be PM2 issue or React Build isssue, probably.

bvaughn
bvaughn
Created 3 months ago

React doesn't serve files, and the only "build issue" that could be related might be if something were related to create-react-app's webpack/babel configurations, but even that seems unlikely to me based on the issue reported above.