Created a default create-react-app project. And tried to run it yarn start. Tried to run it in cmd, powershell.
And getting an error:
my-app/node_modules/.bin/react-scripts: node: not found
This is the problematic line in the script:
node "$basedir/../react-scripts/bin/react-scripts.js" "$#" <-- node not found
I checked my PATH vars and set a high priority for C:\Program Files\nodejs
Reinstalled node.js and installed a different version 12.14
UPDATE:
If I run it in bash it works properly. But still, though need to solve it on other terminals
The problem was I had installed WSL and somehow it was running in that environment and there wasn't Node installed there. So I removed WSL and now it runs okay.
Related
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.
I used the Windows 10 bash subsystem to run a React app. When I installed the node modules and ran the app from the bash all worked fine, but when I tried running it from windows terminal (having installed all the global packages and using the same node version) I got 'react-scripts' is not recognized as an internal or external command
When I removed node_modules and reinstalled them through Windows terminal, all worked fine. So my question is: are some modules written differently for different platforms? Will it cause errors working from sometimes from bash and sometimes from CMD on Windows?
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
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
Hi Stackoverflow community,
Well the thing is that I'm working on a script for hubot. Before starting to code I'm trying to test some hubot commands in the command line (I already did it in Windows but for some reasons I've to change to Ubuntu environment to start to code this brand new custom hubot) I'd like to be able to write in the terminal >Hubot PING and get a response PONG to start to work.
Till now I've already installed Node.js through nodenv https://github.com/OiNutter/nodenv and I tested my node >node -v, got v0.10.22. I forked my hubot and cloned locally and then apply ~./hubot> npm install to get all the dependencies and everything seems OK. Then I went to the installation folder >cd node_modules/hosted-hubot which has a folder called bin, inside the hubot folder.
So, till this point everything seemed OK and I tried to do in the command line: ./bin/hubot and I'm not able to run hubot locally, it gave me: nodenv: version `v0.8' is not installed. I tried to install an older version of node 0.8 and got the same message.
So that's it, hope you guys can help me to try to test my hubot locally
Thanks in advance!!!
I made a fresh install and I instal node.js without nodenv and everything works properly. It may not be the better solution but it was what I did.