Nodemon невозможно загрузить файл
I have installed nodemon
npm install nodemon --g
and the server is starting as it is suppose to but then while i change in my file
it says
restarting due to changes.
and nothing other then this line and the weird thing is
the server didnot restart i have restarted my pc tried updating the nodemon my friend is using same thing and in his computer it worked but not mine. I m not sure what the isuue is.
Can anyone help me here.
nodemon index.js [nodemon] 1.18.9 [nodemon] to restart at any time, enter rs [nodemon] watching: *.* [nodemon] starting node index.js the app is running. [nodemon] restarting due to changes.
The text was updated successfully, but these errors were encountered:
14 Answers 14
Since node prefix is not in the PATH ENV variable , any of the globally installed modules are not getting recognized.
Please try this.
Open cmd prompt
npm config get prefix
append the resulting path to PATH env variable.
Now you should be able to run nodemon from any location.
This is what i have done on my local machine
In my case I also had to add '/bin' after this config path, placed the result in .bashrc (using export PATH etc).
sometime Appdata folder is hidden you can just type C:\Users\username\AppData\Roaming\npm in windows folder path. username should be your computer name .
It worked for me when I added the path somewhere in between the existing PATH, did not work when the path was added to the end of PATH variable. Also all the CMD/ Terminal windows need to be restarted.
I also got same error as you with this command:
I just really switched as "root" and then just ran:
I think npm has a bug to not work with sudo , but it works fine when you are really "root".
Works for me too. I already had Roaming\npm on my path. It appears that installing npm with the -g is needed on windows. (document says -g or -global is needed to add the bin of the command line utility to the PATH)
Single line solution In terminal
There is a problem with integrated terminal of vs code. when I try in external terminal nodemon works. But in integrated terminal, it gives bash: nodemon: command not found error.
so here is my solution
install nodemon as development dependency
and change package.json of the project
to run nodemon type into terminal in project folder
Mine was I went to Control Panel and Repair the NodeJS app and tried to install again with npm install -g nodemon and now it works. Maybe you mixed up or something with Node.
Linux users: I would highly suggest not using sudo or root user to install npm packages. This could become a security problem especially on a production system. I would also suggest not trying to hack permissions as I have hosed an Ubuntu system by not reading the warning on the npmjs procedure.
It would be better to configure npm to use a folder owned by the current user. Simplest approach
Or get the code script on github to see how it works
See details on the npmjs website
On Windows, I was having issues installing nodemon directly from the Command line. Downloaded Cygwin and I was able to npm install nodemon instantly.
You can add path to node packages in System Path variable. Add "C:\Users\UserName\AppData\Roaming\npm".
Even after adding path to System Path variable it did not work for me using nodemon . Then i used npm run serve to run the server. now it is up and running. Btw i am a windows user
This command worked for me.
If your global installation didn't work then install it in your development dependency.
Updated
After Path settings we also need to type in the following commands
what this command enables running scripts on the system
I think some of us can't reach global environments without admin privileges. If you tried everything and it's still not working, try running VSCode as administrator. It worked out for me.
had the same problem otherwise was just working fine a day ago. Very simple fix first check if nodemon exists on your system globally or not
If you don't see then install it npm install -g nodemon (g stands for globally)
If you see it still doesn't work then you need to configure environment variable I use Windows OS. On Windows navigate to
Now check if you have this PATH C:\Users\yourUsername\AppData\Roaming\npm
If not, you will see some existing paths, just append to it separating with semicolon. That's it! Worked for me. For me node was installed in C. \Roaming\npm and for you if the PATH is different, you will put in whatever applcable.
I installed nodemon like it tells you to with npm i nodemon but when i go to use nodemon commands like nodemon index.js or nodemon -v it says 'nodemon' is not recognised as an internal or external command, operable program or batch file.
Im running the following:
• node v12.2.0
• npm v6.10.1
• windows 10
the terminals ive tried this with:
• command prompt
• cmder
• git bash
• power-shell
The text was updated successfully, but these errors were encountered:
LemuelCushing commented Feb 15, 2019
@remy sorry for the delay - I've just set up a simple package with nothing but nodemon and the basic "hello world" app.js file. I'm using nodemon as a dev dependency, and my yarn start is set to nodemon app.js .
When I start it, I get the usual message:
When I make a change to app.js and save it, I get
[nodemon] restarting due to changes.
Which just hangs.
If I add the -V flag, the follwing is displayed:
And after I save a change:
LemuelCushing commented Jan 18, 2019
Same here, been looking for a solution all over. Windows 10, reverting to @1.17.15 didn't make a difference
jordanbtucker commented May 23, 2019
@victorblq What do you get when you run this?
I just want to rule out whether it's an issue with chokidar.
llupRisingll commented Jan 14, 2019 •
I am using version 1.17.15 for about an hour now and it was stuck at restarting due to changes. The same issue in version 1.18.x.
It stopped working after a trying to save changes multiple times before the "Starting node app.js" message appear.
The problem is somewhat hard to figure out since the installation also WARNs about the optional module fsevent not being able to install.
Charlotte000 commented Aug 27, 2019 •
I had the same problem on win 7. The issue was founded accidentally. My solution was adding C:\Windows\System32\ to the system variable in the PATH.
postoyevstanislav commented Apr 8, 2020
Start Windows PowerShell with the "Run as Administrator" option. Only members of the
Administrators group on the computer can change the execution policy.
Я хочу использовать nodemon для мониторинга моего узла.JS app, затем я выполняю команду следующей строки:
когда я перехожу в папку приложения и пытаюсь
система говорит следующее:
"nodemon" не распознается как внутренняя или внешняя команда, программа или пакетный файл.
поскольку префикс узла не находится в переменной PATH ENV, ни один из глобально установленных модулей не распознается.
пожалуйста, попробуйте это.
открываем cmd строки
конфигурация npm получить префикс
добавьте полученный путь к переменной PATH env.
теперь вы сможете запускать nodemon из любого места.
Это то, что я сделал на моей локальной машине
Я также получил ту же ошибку, что и вы с этой командой:
Я просто действительно переключился как "root" , а затем просто побежал:
Я думаю, что npm имеет ошибку, чтобы не работать с sudo , но он отлично работает, когда вы действительно "корень".
вы можете добавить путь к пакетам узлов в системной переменной Path. Добавить "C:\Users\UserName\AppData\Roaming\npm".
пользователи Linux: я настоятельно рекомендую не использовать sudo или root user для установки пакетов npm. Это может стать проблемой безопасности, особенно в производственной системе. Я бы также предложил не пытаться взломать разрешения, поскольку я поливал систему Ubuntu, не читая предупреждение о процедуре npmjs.
было бы лучше настроить npm для использования папки, принадлежащей текущему пользователю. Самый простой подход
или получить код скрипт на github чтобы увидеть, как это работает
On Windows, у меня возникли проблемы с установкой nodemon непосредственно из командной строки. Скачано Cygwin и я смог npm установить nodemon мгновенно.
мой был я пошел на панель управления и ремонт приложения NodeJS и попытался установить снова с npm install -g nodemon и теперь он работает. Может, ты что-то перепутал с узлом.
и затем запустить
даже после добавления пути к системной переменной Path он не работал для меня, используя nodemon . Тогда я использовал npm run serve для запуска сервера. теперь он работает. Кстати, я пользователь windows:) LUNddd lelo
однострочное решение В терминале
была такая же проблема, в противном случае просто работает нормально, день назад. Очень простое исправление сначала проверьте, существует ли nodemon в вашей системе глобально или нет
если вы не видите, то установите это npm install -g nodemon (g означает глобально)
Если вы видите, что он все еще не работает, вам нужно настроить переменную среды я использую ОС Windows. в Windows перейдите к
теперь проверьте, есть ли у вас это Путь C:\Users\yourUsername\AppData\Roaming\npm
если нет, вы увидите некоторые существующие пути, просто добавьте к нему разделение с запятой. Вот так! работал для меня. Для меня узел был установлен в C. \Roaming\npm и для вас, если путь отличается, вы поместите все, что можно применить.
I want to use nodemon for monitoring my node.js app's, then I execute the next line command:
When I move to my app folder and try to to
The system tells to the next:
"nodemon 'is not recognized as an internal or external command, program or batch file.
deepak-singh343 commented Feb 12, 2020
I had the same problem on win 7. The issue was founded accidentally. My solution was adding C:\Windows\System32\ to the system variable in the PATH.
it also worked for me in windows 10 64bit
jordanbtucker commented May 24, 2019
This looks like a different issue since it's actually watching the file:
The error you're getting is because it needs to be transpiled with something like babel.
jordanbtucker commented May 23, 2019 •
Thanks. How about this?
Replace dir twice with the name of the directory you want to watch. Make sure there's at least one .js file in that directory.
schivmeister commented Dec 4, 2019
Something is very wrong. I install Node for Windows using the official installer (without installing the additional tools). I run the global install command for nodemon. I see there is a new folder for nodemon in the relevant global node_modules folder. However, Windows (8.1) still cannot find nodemon.
Windows can execute node itself because there is a batch file for it. However, aside from a couple of other batch files, there's no other executable, and no executable for nodemon. The nodemon binary is not a binary but a JavaScript file. Nevertheless, there's nothing equivalent to a wrapper that runs node nodemon post-install.
Vulplion commented Aug 26, 2019
I updated Node from 10.16.0 to 10.16.3 and now it works again fine.
I have the same issues as you guys, never have had this issue before. I am currently on 10.16.3 although and its still broken.
stale bot commented Dec 15, 2018
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
bke-daniel commented Jan 18, 2019 •
some goes for OSX. Info nodemon is installed locally, not globally.
node -v v8.15.0 npx nodemon -v 1.18.9
Edit:
Tried to add a nodemon.json (with and without --config ) as well as adding config to the package.json
fpsantos86 commented Feb 20, 2020
Can you all retest with nodemon@1.18.10 - it might fix the issue you were seeing.
Otherwise, since there's been no interest in finding the source of the issue on this thread, I'll close it in a few days.
@remy I retested it but when I update the file and make a new request I get the previous result, even with the nodemon running.
Note: I started getting this problem with the latest version of the nodemon: 2.0.2
jordanbtucker commented Apr 8, 2019 •
Star, I'll push a bumpped version of nodemon to pull the updated dep (others: you sho be able to reinstall nodemon and it should pick up the latest change in chokidar.
@remy Can you bump the chokidar dependency to 2.1.5? Currently, reinstalling nodemon doesn't work if chokidar@2.1.3 is already in the dependency tree either directly or from another package.
For example, if I run npm i -D chokidar@2.1.3 , reinstalling nodemon is not going to pull down chokidar@2.1.5. It's just going to use 2.1.3, which has the bug.
Nuking node_modules and reinstalling should work, but only if another package hasn't pinned chokidar@2.1.3.
d4rth-v4d3r commented Apr 9, 2019
@remy I revert from version 1.18.10 to 1.18.0 because it was not working
fpsantos86 commented Feb 20, 2020
It seems that this problem has returned, the nodemon even runs the application, but after I change a file and save the request executed by Insomnia (a program like the postman) it returns the same value as before.
NOTICE THAT AFTER I CHANGE FROM "CLÁUDIO" TO "ROBSON" THE ANSWER IN INSOMNIA:
Help me please. I've searched a lot on the internet but I think this is the right place.
hubitor commented Dec 1, 2018
Okay, to rule things out, do you get the error when you install nodemon locally as a development
dependency? (without sudo).
No. Locally it gets installed normally (two warnings about fsevents like before but no error ).
(Aside, you'll want to fix your permissions, I'm sure there's an article I've come across in the past by npm that explains how to fix it - the biggest potential threat is a malicious package is downloads and run under your sudo access)
Thanks for the tip! I'll look into it.
d4rth-v4d3r commented Apr 8, 2019
I'm having a similiar issue in Windows 10 Pro and nodemon@1.18.10. I'm using the command:
yarn cross-env NODE_ENV=development nodemon --watch dist-dev --inspect dist-dev/lib/index.js
Nodemon is not restarting when a file is modified 😢 . I installed version 1.18.0 and this command works like a charm. 🐱🐉
katarisrividya commented Apr 20, 2020
This issue is related to your node configuration. It's not be set to work for globally installed files (not sure how though, I don't use windows).
That error is telling you that Windows doesn't know how to execute the nodemon command. If you try node ./node_modules/.bin/nodemon I'm pretty sure it'll work (I'll reopen this issue if it doesn't).
If prefixing with node, it means that there's a machine setup problem, rather than nodemon.
If it doesn't work prefixed with node, then there's something else at play and I'll reopen.
It worked thank you
SerenModz21 commented Aug 22, 2019
But the problem i have to keep putting the nodemon and .bin folders into node_modules and a load of other folders that it asks for and it can get really annoying
victorblq commented May 23, 2019
tylerreece22 commented Feb 14, 2019 •
If you want to use nodemon on Windows 10 but can't get it to work globally you can always install it as a dev dependency, cd into your project directory, and run yarn run nodemon and it will function the same. Hope that helps.
remy commented Feb 8, 2019
Can you all retest with nodemon@1.18.10 - it might fix the issue you were seeing.
Otherwise, since there's been no interest in finding the source of the issue on this thread, I'll close it in a few days.
jordanbtucker commented Jun 20, 2019
@shahidfoy Just running nodemon will run the global install of nodemon. You can find out what version that is by running npm ls -g nodemon . Running npm run dev will run the version of nodemon installed in node_modules . That's probably why you're seeing different behavior.
RitvikSangwan commented Jan 13, 2019
I am also facing the same problem on windows 8.1 and nodemon version 1.18.9
copiyot commented Mar 4, 2020
remy commented Feb 11, 2019
@LemuelCushing can you detail what you're seeing and how you're able to replicate with as little code as possible?
jordanbtucker commented Apr 8, 2019
@d4rth-v4d3r What do you get when you run this?
If you see chokidar@2.1.3 or chokidar@2.1.4 , then that's your problem. It needs to be chokidar@2.1.5 or later.
remy commented Sep 5, 2019
This issue is related to your node configuration. It's not be set to work for globally installed files (not sure how though, I don't use windows).
That error is telling you that Windows doesn't know how to execute the nodemon command. If you try node ./node_modules/.bin/nodemon I'm pretty sure it'll work (I'll reopen this issue if it doesn't).
If prefixing with node, it means that there's a machine setup problem, rather than nodemon.
If it doesn't work prefixed with node, then there's something else at play and I'll reopen.
remy changed the title nodemon' is not recognised as an internal or external command, operable program or batch file. Sep 5, 2019
victorblq commented May 24, 2019 •
I'm following an expressjs tutorial, if I run:
it works, but not refresh with code changes (this original issue)
and when I run with yout snippet, replacing "dir" with "src", that in my case contains a index.js file, I get this:
actually, I'm working at my laptop now(Linux) and everything is fine. Logged at my desktop(Windows) just to test your solution in case of anyone need it.
RitvikSangwan commented Jan 13, 2019
I am also facing the same problem on windows 8.1 and nodemon version 1.18.9
jordanbtucker commented Apr 9, 2019
@d4rth-v4d3r I installed your dependencies. I was able to get it working by reinstalling nodemon.
Since nodemon is the only dependency that requires chokidar@2.1, chokidar@2.1 will also get reinstalled at the latest version. Note that this is different than npm update nodemon as that won't necessarily update chokidar, at least not until remy bumps the chokidar dependency in nodemon.
bernarddoci commented Oct 29, 2019 •
You should run PowerShell as administrator then:
PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSigned
and press A
LemuelCushing commented Feb 11, 2019
Hi @remy, I've upgraded to 1.18.10, but to no avail..
paulmillr commented Mar 22, 2019
remy commented Mar 23, 2019
Star, I'll push a bumpped version of nodemon to pull the updated dep (others: you sho be able to reinstall nodemon and it *should* pick up the latest change in chokidar.
On Fri, 22 Mar 2019, 21:20 Paul Miller, ***@***.***> wrote: Fixed chokidar. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .
jordanbtucker commented Apr 8, 2019
@d4rth-v4d3r That's strange. What are the dependencies and devDependencies in package.json ?
llupRisingll commented Jan 14, 2019
I tries debugging by reverting back to old versions. and guess what?
For windows machine, please stick with version 1.17.15. It is working well and will fix the bug.
Use npm i -g nodemon@1.17.15 hope that helps.
d4rth-v4d3r commented Apr 8, 2019
This is my output
| +-- chokidar@1.7.0
| +-- chokidar@2.1.4 extraneous
hubitor commented Dec 1, 2018
Have you tried installing without sudo?
I always install npm packages globally with sudo because of permission errors.
This is what I get without sudo:
stale bot commented Mar 10, 2019
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
shahidfoy commented Jun 20, 2019 •
I had the same issue Windows 10, for whatever reason nodemon wont run on some of my projects,
here's a duck-tape work around, ask npm to run a nodemon script in package.json
"scripts": < "dev": "nodemon server" >,
then just run npm run dev
currently works for me
using
"nodemon": "^1.19.1"
another thing that worked for me was deleting the package-lock.json (make a copy if you scared) then closing all text editors/ide's & terminals associated with the application and opening them again and run npm install in the terminal to reload package-lock.json . This allowed me to use nodemon and ng commands (was having issues with ng too)
remy commented Apr 8, 2019
@d4rth-v4d3r your version of nodemon is 1.18.0 not the latest.
@jordanbtucker thank you for your support on this thread - much appreciated 👍 ❤️
I'm pushing a release that upgrades chokidar directly - though most users should get the dep upgrade automatically as it pulls chokidar@^2.1.0
fpsantos86 commented Feb 19, 2020
llupRisingll commented Jan 14, 2019 •
stale bot commented Feb 4, 2019
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
remy commented Jan 14, 2019
Those old versions also include deep vulnerabilities, which is why older versions are not supported.
d4rth-v4d3r commented Apr 8, 2019 •
remy commented Dec 1, 2018
Okay, to rule things out, do you get the error when you install nodemon locally as a development dependency? (without sudo).
(Aside, you'll want to fix your permissions, I'm sure there's an article I've come across in the past by npm that explains how to fix it - the biggest potential threat is a malicious package is downloads and run under your sudo access)
jhonissongabriel commented Oct 13, 2019 •
This worked for me!
npm install -g nodemon
npm install --save-dev nodemon
npm config get prefix
set PATH=%PATH%;C:\Users"Your User"\AppData\Roaming\npm;
serhatates commented Dec 8, 2020 •
it didnt work in cmd but when i tried it in git bash, it worked
then i put it in a bat file and that also worked
you have to do C:\>"./node_modules/.bin/nodemon" -v
in windows
remy commented Jan 13, 2019
Care to debug rather than "me too"? Happy to take PRs that will fix or even some actual debugging information to replicate and fix…
fpsantos86 commented Feb 18, 2020
I'm having the same problem, can you help me please. How can i solve it.
joe-oli commented Jan 1, 2021
Actually in 2021 I had the same problem, the DOCS should be made explicit to tell Windows users to use back-slash
$./node_modules/.bin/nodemon
should be ON WINDOWS
** Does not only apply to this Lib only, lots of examples, tutes out there are written by a Mac/Linux user for other Mac/Linux users.
I'm getting following error when I try to install nodemon globally:
- nodemon -v : 1.18.4
- node -v : v10.14.0
- Operating system/terminal environment: Antergos (Arch Linux) / zsh
- Command you ran: $ sudo npm install -g nodemon
The text was updated successfully, but these errors were encountered:
CodeWilliamson commented Mar 22, 2019
I'm having same issue on Windows Server 2016. I've tried nodemon globally and locally and no luck. If I run in verbose mode it says watching 0 files despite having my app.js file clearly present. It also reads that it's watching . with extensions: js,mjs,json . anybody having luck with this?
SerenModz21 commented Aug 17, 2019 •
it didnt work in cmd but when i tried it in git bash, it worked
then i put it in a bat file and that also worked
victorblq commented May 23, 2019
I'm having this issue with 1.19.0, windows 10 64bits also.
jordanbtucker commented Mar 22, 2019
This can be fixed in nodemon by setting atomic to false in the options for chokidar.watch .
Читайте также: