Npm package commands stopped working after installing Homebrew on Mac - node.js

I'm using nodemon for my node.js project and wanted to install MongoDB locally on my Mac which runs Catalina 10.15.7. For that I installed the latest version of Homebrew. I started the MongoDB server sucessfully and connected to it with MongoDB compass.
After that I switched back to my nodejs project and noticed that in my zsh terminal (in Visual Studio Code) I suddenly couldn't use the nodemon command anymore. I get the error:
zsh: command not found: nodemon
I reinstalled nodemon in the project and globally too but that didn't work. I read that it's a problem with the .zshrc file so I tried to create one with the nano editor and add
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
but that didn't work either (I tried to replace npm-global with npm-package).
At this point I have no idea where the issue is. Any suggestions?

I don't know why but reinstalling nodemon globally with sudo worked somehow.

Related

nodemon command not found in git bash

I am trying to run my node.js app in Git bash terminal. It worked before every time I type nodemon server.js. Recently, I upgrated my node.js and npm. If I try to run my app on Git Bash again, an error of
C:\Users\PC\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found
Shows up.
I tried uninstalling and installing nodemon with npm install -g nodemon, and reinstalled git, the error still persists. Although, nodemon works fine on windows cmd terminal.
It would be nice to make it work on Git Bash terminal.
it actually comes down to the place you installed the Nodemon tool.
most people will install it in their working directory but i found that this way is not a safe bet. you should install it in the root directory as it will not cause trouble once you try to use it in another project.
Also facing the same issue! But I found a way around using npx nodemon script.js
Although I found the problem. Git bash is trying to execute nodemon from this directory: C:\Users\username\AppData\Roaming\npm/node_modules/node/bin/node
But in this path nodemon doesn't exist.
The path should be C:\Users\username\AppData\Roaming\npm\node_modules\nodemon

Cmmand issue - "ng" command not recognized as internal or external even when is in PATH Environment Variable [duplicate]

This question already has answers here:
ng is not recognized as an internal or external command
(51 answers)
Closed 3 years ago.
For some reason, yesterday, all my commands (ng, npm, node, etc.) were working fine, but at night I cleaned my PC from trash files and all that (my pc has Windows installed), and now it doesn't recognize the ng command, but all the others are OK.
I checked the Environment Variables and its path is there, I checked the path, and it's all right, I re-installed with:
npm install -g angular-cli**
However, nothing happened. I rebooted the computer and all that, but I just can't get ng working again.
I ran into this same snafu when I was trying to install Angular (v4.0) correctly. The way I corrected it, after I incorrectly executed npm install #angular/cli -- which generated a directory called node_modules.
To correctly install angular with npm, remove the directory node_modules, then simply start a new bash shell or simply open a new console or terminal tab, and execute sudo npm install -g #angular/cli. This may prompt you for your machine's password, so be prepared to enter it without being able to see it.
It seems like you were following the Angular weblog's instructions for installing Angular v4. You can do that instead instead just as easily; The key to installing Angular v4 correctly on my machine (besides updating my nodejs installation to the prerequisite latest version), was using sudo with the -g (aka. global) option.
At the end I made it work, I had to uninstall even all my NodeJs, de #angular/cli and the angular-cli, Rebooted my computer and then reinstalling NodeJs latest version and installed Angular with npm install -g #angular/cli#latest and removed from PATH and Environment Variables the old paths and got it running fine!
For me (In Windows) the problem was that the npm path was not saved in the path environment variable. If you browse to
C:\users\yourname\AppData\Roaming\npm
Inside this directory you can see ng (a javascript file) and ng.cmd (the windows command file that executes the javascript file). This path needs to be in your path variable to be able to call ng

Node cli on Msysgit on WIndows 10

I recently decided to pick up Node on my personal laptop, which I upgraded to Windows 10, and the Node cli seems to hang when I try to run it.
Simply typing node on the console will not initiate the interface, and to do anything else I need to Ctrl+C out of it.
Additionally, running some npm commands take longer than they used to on my laptop. More noticeably, npm init seems to hang after confirming the information to be written to package.json.
Node version is 4.0.0
npm version is 2.14.2
Are there any known issues with Node and npm on Windows 10?
Edit:
After some troubleshooting, I've figured out the error only happens on Msysgit. Neither of the issues happen on the standard command prompt of Windows.
I had the same issue on Windows 7 with Node version 6.11.0 and Msysgit's MINGW64 terminal window.
The problem was caused by the an alias provided by Msysgit as demonstrated below:
$ alias node
alias node='winpty node.exe'
The solution is to run the command:
$ unalias node
Then node will run correctly.
You can add the unalias node command into your .bashrc file in your HOME directory to make this permanent.
Good luck!
Jeff

Nodemon stopped working

I use nodemon to work with node.js. All is fine. Today I typed nodemon app.js and it doesn't know the command.
I reinstalled with npm install -g nodemon.
It reinstalled without any error.
It still doesn't work.
under:
user\AppData\Roaming\npm
I removed all files depending nodemon.
Again I reinstalled but it still doesnt know the command. What happend and what to do?
Windows 8.1
Open and run the command line window as administrator and run the command npm install -g nodemon

./bin/neo4j install not working

I am trying to install neo4j Linux version. I have created $NEO4J_HOME in my bashrc and cd $NEO4J_HOME works fine. However, when I try to run ./bin/neo4j install, I get "Legacy install now lives in the 'neo4j-installer' script" and nothing else. Am I doing something wrong? Running ./bin/neo4j-installer install gives warning that this is outdated version etc. That one starts installation, but ./bin/neo4j install doesn't do anything. I am installing neo4j-community-2.1.5 What am I doing wrong?

Resources