Gulp Not Found Even after Changing Global File Path - node.js

I've done all of the recommendations found in other StackOverflow posts about this, but the issue still isn't resolved. I've run the prefix command without it fixing the issue, attempted to remove Gulp and re-install, and run npm install and npm update. Been working on this for hours and no luck. Any help would be much appreciated.
I am running Git Bash with the following folders:
$ npm root -g
C:\Program Files\Git\usr\local\node_modules
$ npm root --dev
C:\Users\HalvorSD\mofficialdev\node_modules
$ npm root -g gulp
C:\Program Files\Git\usr\local\node_modules
Under environment variables in Advanced System Properties, I have:
Variable name: NODE_PATH
Variable value: %AppData%\npm\node_modules

Related

My npm globally installed packages don't work

I installed a cute-files npm package globally (it doesn't matter it could be anything else), I expect when I run:
cute-files
I will see result but now I see cute-files isn't a command.
I should tell you I changed my npm directory because of some permission errors and now my npm directory is:
/home/nima/.npm-g/lib/node_modules
And one more point when I run this command:
echo $NODE_PATH
I see no results and when I set node path with this command:
NODE_PATH="/home/nima/.npm-g/lib/node_modules"
it doesn't fix my problem and after few minutes NODE_PATH again changes to nothing!
I googled very much but I couldn't fix this.

Install for #angular/cli not working on Mac

I'm trying to setup Angular 2 using "npm install #angular/cli -g "
After the install, the only warning I see is the UNMET PEER DEPENDENCY rxjs#^5.0.1, which I then install and reinstall "npm install #angular/cli -g"
No matter what I do, or what version of Node I setup with n, I keep getting the following message when trying to user the "ng" commands:
zsh: command not found: ng
I've been looking around and have not found a solution for this.
Has anyone run into this and have any suggestions?
UPDATE:
It looks like this is not a angular/cli specific issue.
I now see that I get the same message when I try to run "Grunt" and "Ionic" commands on an existing project that was working fine.
zsh: command not found: ionic
zsh: command not found: grunt
Most likely, the directory in which the global modules are installed is not in your $PATH -- and therefore unknown to your shell.
To fix this issue, we can create a new directory for global node_modules, configure npm to use it, and add that directory to your $PATH.
# create a new directory where npm will install packages
$ mkdir ~/.node_modules
# set npm "prefix" config to that directory
$ npm config set prefix '~/.node_modules'
# append a line to your .zshrc instructing it to include that directory in your $PATH, making the executables known to the shell
$ echo 'export PATH=~/.node_modules/bin:$PATH' >> ~/.zshrc
# update current shell with new path (not needed for new sessions)
$ source ~/.zshrc
Then, first reinstall the latest npm (npm i -g npm), followed by the global packages you need (npm i -g #angular/cli).
For more on PATH, see this definition: http://www.linfo.org/path_env_var.html

unable use any installed npm packages

I'm trying to use node on my fedora 21 installation. However whenever I install a package via npm I am not able to to call that package such as gulp.
npm install -g gulp
then : gulp run
error:
zsh: command not found: gulp
You need to point your global $PATH variable to the location of node. Otherwise, it will return that error.
Open your .zshrc file and ensure you see something like PATH=/usr/bin/node:$PATH (ensuring your directory is the proper one for node). You can find that directory location with the command npm -g bin.
If that doesn't work, comment below. Thanks
The directory where npm installed gulp is not in your path. To find out where it was installed, run npm -g bin and make sure the directory is in your path. Alternatively, execute gulp as $(npm -g bin)/gulp.

Why do I keep getting errors with NodeJs and npm when installing yeoman?

I am currently on windows 7 trying to install nodejs and npm to use with git and yeoman. I have uninstalled node and git multiple times and keep getting the same errors
`Welcome to Git (version 1.9.4-preview20140815)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
Jeff#JEFF-PC ~
$ node --version
v0.10.32
Jeff#JEFF-PC ~
$ npm --version
1.4.28
Jeff#JEFF-PC ~
$ npm install --global yo
c:\UsersJeffnpm\yo -> c:\UsersJeffnpm\node_modules\yo\cli.js
> yo#1.2.1 postinstall c:\UsersJeffnpm\node_modules\yo
> node ./scripts/doctor
[Yeoman Doctor] Uh oh, I found potential errors on your machine
---------------
[Error] npm root value is not in your NODE_PATH
[info]
NODE_PATH = :\Users\Jeff\npm\node_modules:\home\npm\lib\node_modules
npm root = c:\UsersJeffnpm\node_modules
[Fix] Append the npm root value to your NODE_PATH variable
If you're using cmd.exe, run this command to fix the issue:
setx NODE_PATH "%NODE_PATH%;c:\UsersJeffnpm\node_modules"
Then restart your command line. Otherwise, you can setup NODE_PATH manually:
https://github.com/sindresorhus/guides/blob/master/set-environment-variabl
es.md#windows
I've tried the command that the yeoman doctor suggested and tried editing the environment variables manually and keep getting these errors. Do I need to edit my .bashrc or .gitconfig files?
Here's my .bashrc content:
export PATH=$PATH:/usr/local/bin
export NODE_PATH=:/Users/Jeff/npm/node_modules
export NODE_PATH=:/Users/Jeff/npm/node_modules:/home//npm/lib/node_modules
If I can change my environment variables or edit my paths please let me know! I greatly appreciate any help you have!
In the second line of your .bashrc you'll note that you have /home//npm/lib/node_modules. Based off the other items in that file I'm betting it should be /Users/Jeff/npm/lib/node_modules or similar.

Cannot run ionic. receives "No command 'ionic' found"

I want to start using the ionic framework, but unfortunately I'm already failing on the first step.
I am running Ubuntu 13.04 and I have node v0.10.25 installed.
I've installed ionic, at described in their docs:
sudo npm install -g cordova
sudo npm install -g ionic
The installation went well, no errors or warnings, but after the installation I type
ionic
and I get the error:
No command 'ionic' found, did you mean:
Command 'ionice' from package 'util-linux' (main)
Command 'sonic' from package 'sonic' (universe)
ionic: command not found
I'm pretty new to ubuntu so I might have something not configured correctly, but I can't find what.
Thanks
for some of you, the two answer above might not work. here's a more general solution for situation where you see "XX" command not found
first check your npm root and npm root -g
the result for the npm root -g should be something like "/usr/local".
if it's not, then you found your problem.
change it by:
npm config set prefix /usr/local
then npm root -g should give you something like /usr/local/lib/node_modules
.
Then go ahead re-install everything with -g
you will be good to go!
Well, I found it finally.
The ionic installation was at /home/guy/npm/bin/ionic, not at /usr/bin/ionic at it should be.
Solved it with:
sudo ln -s /home/guy/npm/bin/ionic /usr/bin/ionic
I solved the problem by cd to my root. Then install ionic as root admin.
$ sudo npm install -g cordova ionic
then run
$ ionic
to see if it's working.
Someone might run into this after trying to change the global library directory of npm to a folder they have permissions to write to in order to be able to install global libs without root permissions.
In that case you might have forgotten to add the new folder to you PATH environment variable.
The whole process of fixing Permissions can be found here.
in case that source disappears here is a copy of the steps:
There are times when you do not want to change ownership of the
default directory that npm uses (i.e. /usr) as this could cause some
problems, for example if you are sharing the system with other users.
Instead, you can configure npm to use a different directory
altogether. In our case, this will be a hidden directory in our home folder.
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
Test: Download a package globally without using sudo.
npm install -g jshint
Instead of steps 2-4 you can also use the corresponding ENV variable (e.g. if you don't want to modify
~/.profile):
NPM_CONFIG_PREFIX=~/.npm-global npm install -g jshint
if you just follow these steps and reinstall all the Global libs there is a good chance that it will start working for you anyways...
Just remember that if you do this, you will save your global libs into the folder created in step 1 instead of the default location in /usr/local or just /usr (depending on your OS flavor i guess?)
First Solution
I recently ran into this issue and the only solution that worked for me was to uninstall both ionic and cordova.
npm uninstall -g cordova
npm uninstall -g ionic
Then just reinstall
npm install -g cordova
npm install -g ionic
Second Solution
I ran into this issue again! This time check your environmental variables.
Run npm bin -g and check if the path returned is in your environmental variables. For me, it prompted that it was not found in the terminal output. I added that path to the environmental variables and restarted the terminal. From there everything started to work again. (source)
I had the same problem with “bash: ionic: command not found”,
then I added:
%USERPROFILE%\AppData\Roaming\npm
to my environment variable’s path, then I reinstalled ionic and cordova and it start working.
For Mac users
1. install the ionic
npm i -g #ionic/cli
2. check npm path
npm root -g
3. copy full path of ionic
Ex. /usr/local/Cellar/node/15.2.1/lib/node_modules/#ionic/cli/bin
4. open this file as administrator "/etc/paths" with nano or whatever editor
Ex. sudo nano /etc/paths
5. Add ionic bin file full path to file ends. And save file.
That's it.
Run npm root -g, copy the result path and add it to the paths file:
sudo nano /etc/paths
Restart your console and it will work.
this worked for me. try adding below to the ~/.bash_profile for mac OSX el capitan users:
NPM_PACKAGES="${HOME}/.npm-packages"
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath`
# command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
then run source ~/.bash_profile to reload the profile in terminal.
additional info: node v4.3.1
In my case, I have just uninstalled ionic and then reinstalled it. And it is working fine now.
I also faced same problem but i solved i used following commands on terminal it worked
sudo npm uninstall ionic
then i used
sudo npm install -g cordova ionic#latest
and it worked fine it automatically installs best stabel version of cordova and latest stable version of ionic . for me it installed ionic 3.7.0
and cordova 7.0.1
you can change temporary :
npm config set prefix C:\Users[username]\AppData\Roaming\npm\node_modules2
change the Path in Environment Variables set C:\Users[username]\AppData\Roaming\npm\node_modules2
Run your command to install your package .
open file explorer copy the link C:\Users[username]\AppData\Roaming\npm\node_modules
ok file yourpackage.CMD created another folder Created "node_modules2" in node_modules and contain your package folder.
copy your package file CMD to parent folder "npm"
copy your package folder to parent folder "node_modules"
now run npm config set prefix C:\Users[username]\AppData\Roaming\npm
change the Path in Environment Variables set C:\Users[username]\AppData\Roaming\npm
now package working correctly with Command line
=> this method working with me When npm block in installation Package for IONIC installation and ReactNative and another package npm.
The package name has changed from ionic to #ionic/cli!
To update, run: npm uninstall -g ionic
Then run: npm i -g #ionic/cli

Resources