Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodemon restart process looks for tempfile.js~ and throws an error. #2215

Open
theTutorB opened this issue Aug 12, 2024 · 1 comment
Open
Labels
stale no activity for 2 weeks

Comments

@theTutorB
Copy link

  • node -v: [email protected], [email protected]
  • nodemon -v: 3.1.4
  • Operating system/terminal environment (powershell, gitshell, etc): macOS Monterey v12.6.3/ iTerm2 Build 3.5.3
  • Using Docker? What image: N/A
  • Command you ran: "start": "./node_modules/.bin/nodemon --config nodemon.json --exec ./node_modules/.bin/babel-node src/server.js",

Expected behaviour

When nodemon detects a change in the codebase under watch, it should reload the file that the changes occurred on, and restart the process without issue, with all changes that don't throw errors to load and restart the server application as expected.

Actual behaviour

  1. When nodemon detecs a change, it attempts to find the filename.js~ and not the actual file filename.js.
  2. nodemon throws an error:
{
 "errno": -2,
 "code": "ENOENT",
 "syscall": "stat",
 "path": "/absolute/path/to/project/filename.js~"
 "stack": "Error: ENOENT: no such file or directory, stat      '/absolute/path/to/project/filename.js~'"
 "message": "ENOENT: no such file or directory, stat '/absolute/path/to/project/filename.js~'"
}
  1. Process fails with error

Steps to reproduce

  1. start application using nodemon
  2. make change to file under watch
  3. observe nodemon attmpt to locate file that is temp file and crash with output above.

please see attached

Screen_Shot_2024-08-12_at_10_04_36_AM

any and all support is greatly appreciated!


additional info:

When I run our api locally with npm run start this script gets called:

"start": "./node_modules/.bin/nodemon --config nodemon.json --exec ./node_modules/.bin/babel-node src/server.js",
so far all of this worked just fine without issue, beautiful dev experience... then somewhere I broke it with an update to nodemon i'm sure.

And now whenever I make a change to any file being watched (i.e. I set it to filename.js~ in this case) that nodemon picks up on and attempts to restart the process I get an error every single time...

{
"errno": -2,
"code": "ENOENT",
"syscall": "stat",
"path": "/absolute/path/to/project/filename.js~"
"stack": "Error: ENOENT: no such file or directory, stat '/absolute/path/to/project/filename.js~'"
"message": "ENOENT: no such file or directory, stat '/absolute/path/to/project/filename.js~'"
}
From the research I have been doing it seems like the ENOENT error is occurring because nodemon is trying to watch a backup file (e.g., filename.js~) that does not exist.

I tried updating the nodemon.json config file as well, see below:

{
"ignore": [
"node_modules/",
".test.js",
"dist/",
"seed/",
"reports/",
"logs/",
"swagger.json",
"**/
.js~"
],
"watch": ["src/"],
"verbose": true
}
Not sure how to resolve this issue, and have been dealing with it for a while, but have not been able to figure out what exactly is going on with my timeboxed troubleshooting approach. So hopefully I can get some feedback from the community!


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

@theTutorB theTutorB changed the title Nodemon Nodemon restart process looks for tempfile.js~ and throws an error. Aug 13, 2024
Copy link

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

@github-actions github-actions bot added the stale no activity for 2 weeks label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity for 2 weeks
Projects
None yet
Development

No branches or pull requests

1 participant