Closed EledenGreen closed 6 months ago
Can you try with a different shell from power shell just to rule it out (and if it's still replicates, try directly in the terminal without vs code), again just to narrow it down
Wow. Okay, I'll dig out the windows machine to see if I can replicate and get back to you 👍
When i use node --watch index.js
it starts the nodemon and now it works fine.
I did get the following warning: when i entered node --watch index.js
:
But idk why the command npm run dev
didn't work.
I think I'm also having a similar issue.
npm run dev
"dev": "nodemon --watch 'packages' --watch package.json -x \"npm run build\" -e \"ts\""
If I run npm run dev
nodemon will watch just a single file (package.json). If I execute the nodemon command directly in the terminal it will watch 19 files, which is correct.
If I change the script command and remove the --watch package.json
and execute npm run dev
it will watch 34 files, but none of them will trigger a restart. It detects the changes but does not rerun the command.
If you simplify the project right down to the bare minimum are you still able to replicate?
Yes, I can reproduce this in a bare project. The folder structure is:
nodemon-test
│ package.json
│
└───src
│ index.js
│
└───foo
foo.js
The contents of package.json are:
{
"name": "nodemon-test",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"scripts": {
"dev": "nodemon --watch 'src' --watch package.json -x \"echo I restarted!\" --verbose -e \"js\""
},
"author": "",
"license": "MIT"
}
The same behaviour I reported above is obsverved in this project too.
@DexterHill0 why have you used this? nodemon --watch 'src'
- this tells nodemon to look for a directory called 'src'
including the quotes.
If you try with nodemon --watch src --watch package.json -x \"echo I restarted!\" --verbose -e \"js\"
you should find it monitoring the three files…
When I changed this locally (Windows 11 using powershell in vscode), I saved the index.js
and it triggers a restart echoing out the "I restarted":
this is the same test, but with DEBUG=nodemon,nodemon*
enabled:
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
ISSUE RESOLVED I was able to resolve the issue with the following fix:
I just installed nodemon, version 3.0.3 and the issue persists. The server is stuck in 'Restarting due to changes'. Have to restart server to get changes which is obviously antithetical to the purpose of the package. I have tried to run with both Autosave turned on and off.
Interesting enough I do get a popup from Red Hat Dependency Analytics (Extension)
"The component analysis couldn't fetch data from the following providers: [snyk]"
I have tried doing a search for snyk but couldn't come up with anything. I also tried disabling the Red Hat Dependency extension and this did help either.
Downgrading to nodemon 3.0.0 did not resolve the issue Downgrading to express 4.0.1 did not resolve issue.
Dev environment Window 11 "express": "^4.18.2" "nodemon": "^3.0.3"
~> git --version git version 2.43.0.windows.1
Via stack overflow (from the author above):
Turns out i had to add C:\Windows and C:\Windows\System32 to my PATH variable. My problem is now solved!
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
Automatically closing this issue due to lack of activity
It works after I changed these:
follow me on github if that helped thanks
nodemon -v
: 3.0.3npm run dev
"dev": "nodemon index.js"
Expected behaviour
initial state of index.js:
CHANGES MADE AT :
Actual behaviour
Replicate
npm init
npm install express
npm install --save-dev nodemon
package.json
I have tried the following solutions as well:
npm init
(still no changes are reflected)"dev": "nodemon -L index.js"
(still no changes are reflected)