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
Related
For example when I run gulp I don't have to do npx gulp.
I can omit the npx and just run gulp
How do I do this for my own package?
I've added mycommand to the package npm bin config, but I still always have to do npx mycommand for it to work.
It depends on your operating system. On a UNIX-based OS (ie. Linux or Mac) you can use the alias command:
$ alias gulp="npx gulp"
For the rest of your terminal session, you can then run:
$ gulp
to run npx gulp. However, whenever you restart your terminal program, you'll lose the alias.
To make the alias permanent, you need to add the alias command to the appropriate start-up file (eg. .bashrc, .profile, etc.) for your OS. Simply copy/paste the exact command you used before, at the end of that file, save, and restart your terminal. You'll have the alias permanently.
Aliases in Windows are also possible, but are a bit trickier; see Aliases in Windows command prompt.
You don't have to use npx gulp for gulp because it is installed globally
So, there's gulp.cmd, gulp.ps1 and gulp starting npx gulp somewhere in PATH, so you can run them from there
this answer is low effort, feel free to edit it
if you install gulp globally:
npm i -g gulp
you will be able to just run gulp
I would avoid answers suggesting global installs (npm install -g). Global installs guarantee that everyone working on a project has their own unique set of tools, and the reason companies end up with huge wiki pages on "how to get the project working locally".
You mention the "bin config", but perhaps you're misunderstanding that one. That's not for specifying commands that your app will use. If you were making a cli application, the bin section in package.json is where you would specify the commands exported by your project. For example, gulp exports the gulp command like:
"bin": {
"gulp": "./bin/gulp.js"
},
Instead, you would add dependencies needed by your application to devDependencies. This ensures that everyone using the project will get the same version of all of the tools, such as gulp, tsc
Using npx is a far better solution because you can add everything the project needs in devDependencies, and npx will use that version. For the common command line tools, an alias such as #machineghost suggests is a better way to go, but to expand on it a bit:
Sometimes, the name of the command is different from the name of the package. In those cases, the alias can use:
alias tsc='npx --package=typescript tsc'
Normally, when running npx, it will prompt to install if there is not a version found in the current project. This is often a good safeguard, because it reminds you to add it to the devDependencies of the project. However, if you really want it to "just work" like a global install, you can add the "yes" flag:
alias command=`npx -y gulp`
This will use the version specified in the current project if present, but install it and run it directly if not.
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
nvm (for windows https://github.com/coreybutler/nvm-windows)
I have downloaded the nvm-setup and installed it, but whenever it runs it gives an error message.
I've tried to reinstall the nvm, reset the PATH environment variable and install version 1.1.6, and non of it seems to be working.
NVM_HOME points to my nvm file correctly and it's in the PATH.
C:\Users>nvm --version
Running version 1.1.7.
C:\Users>nvm list
12.3.1
C:\Users>nvm use 12.3.1
exit status 1: 'D:\Program' ���O�����Υ~���R�O�B�i���檺�{���Χ妸�ɡC
This happend when you install nvm in a directory that have spaces in the name, for example: C:\Program Files
Change the install directory for nvm and it solved.
In my case, I also had to install the node in another location without spaces in path
C:\Program Files\nodejs -> C:\nodejs
Try cmd with administrator privileges
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
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.