running lines in my node.js command prompt - javascript

I am new to node.js and Github. I was trying to save some work by using command git add -A and the then I saw these lines below and some many of the lines are just running non-stop. I typed ctrl+c to stop it, but anyone knows what are just happened or what did I do wrong??
Thanks

This is because of how git treats the space character.
Find more info here: https://stackoverflow.com/a/1967986/2874959

Thanks #bcorbella for the answer. Just a small precision to be sure you won't do this as a beginner but never add the node_modules into your git project. Create a .gitignore file with at least:
node_modules
Use npm init, npm install <module> --save to create a package.json... then do simply a npm install when you are checking your project.
More info in here https://docs.npmjs.com/getting-started/using-a-package.json

try setting the config core.eol to native and see if you will get the same error, i see no reason why you should be tracking the node_modules/ folder.
> git config --global core.eol native

Related

Problem with the command "npm install fs"

I am not used to work with Linux, so maybe this is a silly question. In the lab that I am working on, I am asked to run the command "npm install fs" to read/write files.
But here is the error that i have and I don't know how to solve it, i couldn't find similar problems too.
PS: I am working on Ubuntu 17.10.
fs is a module that doesn't have to be installed. It comes part of node.js core so you only need to require it in your code.
Instead of running npm install fs --save, just add the following line in the file you're wanting to use it in:
const fs = require('fs');
Here are the docs: https://nodejs.dev/the-nodejs-fs-module
However, to address your question, the error message your receiving is likely due to the fact that:
You don't have a package.json in your project
You are not in the correct directory when running npm install ... and therefore it cannot find your package.json.
I believe your mistake is that you skipped the part where you initialize your npm repository (which generates your package.json).
To initialize an npm repo, do the following:
Navigate to your project root directory
Run npm init and follow the instructions if when prompted.

npx create-nuxt-app <project-name> not working

I want to create Nuxt.Js app using npx. But i am getting following error.
You have a space in your Windows username. This is a problem with NPX.
This is the path that NPM sees (which is right)
This is the path that NPX sees (which is wrong)
You can fix it by changing your NPM-Cache to another directory (without a space in the path):
npm config set cache C:\your\new\path\npm-cache --global
Source:
https://github.com/zkat/npx/issues/146#issuecomment-384016791
I changed npm-cache directory by writing following command
npm config set cache C:\tmp\nodejs\npm-cache --global
After that npx create-nuxt-app <project-name> worked perfectly.
I had it working using this command.
npm init nuxt-app <project-name>
This problem was resolved in a reddit
https://www.reddit.com/r/vuejs/comments/ie8vab/createnuxtapp_not_working_anyone_else_had_this/
Install it with:
npm i -g create-nuxt-app
Usually npm/npx should propose you to install, but it might not work
This issue can appear if during first try the installation was aborted
I have encountered similar problem and I have multiple spaces in the username.
If the above solutions does not work for you on Windows, there is another way.
Run VS code editor as an administrator.
Open the integrated terminal by clicking on Terminal > New Terminal or by pressing CTRL + SHIFT + '
Instead of using npx use the following
npm init nuxt-app project-name
Point number 3 will only work if you run the VS code editor as Administrator.
I am sure it is the same with external terminals. Run CMD/Gitbash as Administrator
Hope this helps. :D

bash: nodemon command not found windows 10

I spent a lot of time looking for a solution, but didn't find anything (with my case) So...
I checked global packages npm list -g --depth=0 and got
But when I went to the folder C:\Users\Sergey\AppData\Roaming\npm\node_modules, there was no nodemon
I know this question has already existed. Please, help me anyone...
I found a solution (in my case).
All you need is to add C:\Users\Sergey\AppData\Roaming\npm and C:\usr\local (of course with your file paths npm and local) to System variables (Control Panel\System and Security\System\Advanced system settings).
And after that restart your PC
Have you tried re-installing nodemon?
npm i -g nodemon#latest
If that too does not work, try installing nodemon in your project, dont't save it as dependency though.
Also you may to remove node folder and install nodeJS again

Bower: ENOGIT Git is not installed or not in the PATH

Git is installed and is in the path.
Platform: Red Hat Enterprise Linux 5.8.
>which git
/usr/local/bin/git
Yet bower can't find it:
bower angular#1.0.6 ENOGIT git is not installed or not in the PATH
What is the recommended work-around?
Adding Git to Windows 7/8/8.1 Path
Note: You must have msysgit installed on your machine. Also, the path to my Git installation is "C:\Program Files (x86)\Git". Yours might be different. Please check where yours is before continuing.
Open the Windows Environment Variables/Path Window.
Right-click on My Computer -> Properties
Click Advanced System Settings link from the left side column
Click Environment Variables in the bottom of the window
Then under System Variables look for the path variable and click edit
Add the pwd to Git's binary and cmd at the end of the string like this:
;%PROGRAMFILES(x86)%\Git\bin;%PROGRAMFILES(x86)%\Git\cmd
Now test it out in PowerShell. Type git and see if it recognizes the command.
Source: Adding Git to Windows 7 Path
Just use the Git Bash instead of cmd.
Run the following command at your node.js command prompt where "<git path>" is the path to your git bin folder:
set PATH=%PATH%;<git path>;
So, like this:
set PATH=%PATH%;C:\Program Files\Git\bin;
Or this: (Notice the (x86) )
set PATH=%PATH%;C:\Program Files (x86)\Git\bin;
This will add git to your path variables. Be sure you type it correctly or you could possibly delete your path vars which would be bad.
Make sure you installed Git with the second or third option selected from the list. It will penetrate the Git command to cmd by modifying PATH automatically ;)
I had the same error in Windows. Adding git to the path fixed the issue.
G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>bower install
bower bootstrap#~3.0.0 ENOGIT git is not installed or not in the PATH
G:\>PATH
PATH=E:\Program Files\Windows Resource Kits\Tools\;
G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>set PATH=%PATH%;E:\Program Files\Git\bin;
G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>bower install
bower bootstrap#~3.0.0 not-cached git://github.com/twbs/bootstrap.git#~3.0.0
bower bootstrap#~3.0.0 resolve git://github.com/twbs/bootstrap.git#~3.0.0
I am also getting the same error and the solution is first to check if the Git is installed or not in the system and if not please install it.
After installation, open Git Bash or Git Shell from Windows and go to your project (same way you go in command prompt using "cd path"). Git Shell is installed by default with Github windows installation.
Then run the same bower install command. It will work as expected.
The below screenshot shows the command using Git Shell
On Windows, you can try to set the path at the command prompt:
set PATH=%PATH%;C:\Program Files\Git\bin;
When you ran the git install, you probably didn't choose:
"Use Git from the Windows Command Prompts"
during the installation.
Re-run git install, and choose that option.
You are missing the ENVIRONMENT PATH. Follow these steps:
Search for 'Edit the system environment variables'.
Click on 'Environment Variables'.
In the 'System variables' section, scroll down and click on the variable 'Path'. Click 'Edit'.
Append this text to the end of the 'Variable value'.
;%PROGRAMFILES%\Git\bin;%PROGRAMFILES%\Git\cmd
I also got the same problem from cmd and resolved using the following steps.
First install the https://msysgit.github.io/ (if not alredy installed).
Then set the Git path as suggested by skinneejoe:
set PATH=%PATH%;C:\Program Files\Git\bin;
Or this (notice the (x86)):
set PATH=%PATH%;C:\Program Files (x86)\Git\bin;
In Linux:
if you dont have installed git use:
sudo apt-get update
sudo apt-get install git
with command which git you will know the directory where is and then add in path if it is not in that enviroment variable.
I bumped into this problem on a cPanel CentOS 6 linux machine.
The solution for me was to symlink the cPanel git to /usr/local/bin/git
ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git
1.Set the Path of Git in environment variables.
2.From Windows command prompt,
run cd Project\folder\Path\
run the command: bower install
People above already gave solutions for your proplem, I hope so. If someone is facing this issue in 2022 in using docker images, then you should add a command to install git in your image.
For Example you are using alpine image in your Dockerfile. Then it will be something like this :
FROM node:8.3-alpine
# ....... other stuffs .....
RUN apk add git
# ....... other stuffs .....
I solved the problem by install Git Bash from Download Git Bash.
Setting this option 3 when installing the software as shown bellow.
Finally select the project folder by right click using Bash as shown below.
and type
npm install
. It works for me.
npm install from git bash did work for me.
After rebooting PC.
Just use the Git Bash instead of node.js or command prompt
As an Example for installing ReactJS, after opening Git Bash, execute the following command to install react:
bower install --react
I had the same problem and needed to restart the cmd - and the problem goes away.

Bower "Git not in the PATH" error

I just installed git and bower via NPM for a project. It's a first time use.
Then I tried running bower install jQuery for example, I get this specific error:
ENOGIT git is not installed or not in the PATH
Where can I actually define paths and how, and when we say PATHs, what's the main idea?
Also, I really need help with some good resources for learning the concept behind this question or learning NPM usage in general.
I'm using windows 7, 64-bit.
Install msysgit, as stated in the Bower documentation:
To use Bower on Windows, you must install msysgit correctly. Be sure to check the option shown below:
[ ] Use Git bash only
[x] Run Git from the Windows Command Prompt
[ ] Run Git and included Unix tools from the Windows Command Prompt
After the installation has completed, restart CMD. You (and bower) will then be able to run git from the command prompt, which will fix your issue.
Make sure u installed git with 2nd or 3rd option selected from list.
It will penetrate git command to cmd by modifying PATH automatically ;)
Manual method is to add the Git cmd path to your windows PATH environment variable. The Git cmd path will be unique on your machine, and something like:
C:\Users\<YourUserName>\AppData\Local\GitHub\PortableGit_<SomeGuid>\cmd\
From command prompt, add it to your PATH var like so:
path C:\Users\<YourUserName>\AppData\Local\GitHub\PortableGit_<SomeGuid>\cmd\;%PATH%
Install Bower using Git Bash and run bower install jQuery from Git Bash. Git doesn't work from Windows command prompt as CMD is not POSIX compatible.
Forget powershell and command prompt. Use git bash and it works like normal.
Make sure you use the "Git bash" in that directory but not the command terminal of the system:like this
First install git on your pc, if you do not add the path then add it yourself
C:\Program Files\Git\cmd

Categories