nodemon : command not found - macos

On Mac, Homebrew to install node
Installed nodemon with the following command : npm i -g nodemon
But whenever I tried using nodemon it told me : command not found
I then tried adding to the $PATH in my ~/.zprofile (I'm using zsh) the following : /Users/me/npm/lib/node_modules
which I got from using the command npm root -g
Got the following error : zsh: permission denied: nodemon
All the other "solutions" involves using SUDO to install a package, which I would like to avoid.

Fixed by making sure the folder npm was mine with sudo chown -R ``whoami`` npm
The correct way was to add /npm/binand not /npm/lib/node_modulesto the $PATH

Related

Ionic command not found, but Ionic installed successfully

I am attempting to use Ionic but I am getting the following issues when running the ionic start myApp tabs command:
bash: ionic: command not found
I attempted to use sudo and it shows the issue:
sudo: ionic: command not found
I have tried using the ~/.profile file to avoid permission issues and within that file I Have:
export PATH=$PATH:/Users/[USER HERE]/.npm-packages/bin
I also have tried to uninstall and reinstall node.js and then reinstall Cordova and Ionic but this did not work.
I have also tried:
sudo ln -s /home/[USER HERE]/npm/bin/ionic /usr/bin/ionic
but I get back the error:
ln: /usr/bin/ionic: Operation not permitted
Anyone have any other suggestions as to what I could do to resolve this? I am using a Mac.Im using npm 6.7.0 and node 11.12.0
Have you tried this :
npm install -g ionic

How to run npm scripts with WinPTY?

I had the known issue of python freezing in Git bash on windows. Many answers on stackoverflow suggested to use WinPTY.
Which works fine when I use:
winpty python foo.py
But I run a python program as part of a npm script. My package.json has this:
"scripts": {
"start": "python foo.py && something else"
}
So I figure I will need to run npm script with WinPTY too:
winpty npm start
But this is not working. I got different error messages on different environments.
I got "Not found in PATH" at work which has latest git and npm installed, but it is in PATH:
winpty: error: cannot start 'npm': Not found in PATH
I got a different error at my personal computer with a slightly older git:
Error 0x2 starting npm start
Any ideas why npm and winpty isn't working together?
If I run npm start without winpty it works fine. winpty node works too.
I got the same problem.
Actually, in nodejs installation folder, there is npm.cmd
So what you should do to start npm using winpty is
winpty npm.cmd install

"exp: command not found" How do I add expo cli to path?

I installed the expo cli with
npm i -g exp
then I run
exp
and I get
-bash: exp: command not found
I'm guessing I didn't add exp to path. So how do I do this properly? Nothing I've tried so far works.
This suggested 3 steps solution worked for me:
First check if ~/.npm-global/bin is in your path: echo $PATH. If it isn’t there, you will need to add it to the path.
Open up ~/.bash_profile then add the following line to the bottom: export PATH=$PATH:~/.npm-global/bin
Finally, back in the shell, type: source ~/.bash_profile
Hopefully that will have fixed your problem.
1. Find the path where expo is globally installed by npm:
npm bin -g
2. Add path from Step 1 to paths file:
sudo vi /etc/paths
3. Restart the Terminal
You should try npx expo init <your_app_name> to test.
It worked for me.
I also had a hard time getting expo command to work on Mac. Here are the steps I took to get it working.
npm root -g shows the directory the global modules are installed in:
/usr/local/Cellar/node/11.7.0/lib/node_modules
That directory might be different for you. After confirming expo is in there, edit ~/.bash_profile and add the line:
export PATH=$PATH:/usr/local/Cellar/node/11.7.0/bin
Save & exit, then run source ~/.bash_profile
Now the expo command should function as intended.
try sudo npm install --global expo-cli
this worked for me.
➜ MobileDev git:(campaigns-responsive) ✗ expo whoami
› Not logged in, run expo login to authenticate
➜ MobileDev git:(campaigns-responsive) ✗ expo init App
✔ Choose a template: › blank a minimal app as clean as an empty canvas
✔ Downloaded and extracted project files.
📦 Using npm to install packages.
✔ Installed JavaScript dependencies.
✅ Your project is ready!
To run your project, navigate to the directory and run one of the following npm commands.
- cd App
- npm start # you can open iOS, Android, or web from here, or run them directly with the commands below.
- npm run android
- npm run ios
- npm run web
exp was replaced with expo
To install Expo CLI, just run npm install -g expo-cli (or yarn global add expo-cli, whichever you prefer).
Following on this issue, I found I had multiple global folders so I started using a .npm-global folder as shown here: https://docs.npmjs.com/getting-started/fixing-npm-permissions
And now it's all clean and in control.
I had a similar issue.
-bash: expo: command not found
It turns out the command to install expo
npm install -g expo-cli was referencing an older version of node on my machine; when checked using npm root -g.
So I had to uninstall nvm/node, deleted any remnant folders & files of .nvm and shortcuts for nvm in /usr/local. Then reinstalled node and ran npm install -g expo-cli again.
That fixed my issue.
sudo npm install --unsafe-perm -g expo-cli
If you're using git bash on windows, add npm path to your system path variables. Generally located on this location:
C:\Users\<Username>\AppData\Roaming\npm
Then open the bash and command npm start. Hope this will help.
I solved it by putting this in my PATH environment variable / user variable:
C:\Users\{userName}\node_modules\.bin
yarn expo start
Worked for me.
npx create-expo-app project-name

Cordova command not found - can not be used globally

so I have installed cordova using the following command to use it globally
sudo npm install -g cordova
and I get the following message
/Users/safwany/.node/bin/cordova -> /Users/safwany/.node/lib/node_modules/cordova/bin/cordova
cordova#5.1.1 /Users/safwany/.node/lib/node_modules/cordova
I keep typing cordova in the terminal but I am getting command not found. The only I can get it working is by typing the following:
/Users/safwany/.node/lib/node_modules/cordova/bin/cordova
Any idea how can I change that so I can use it globally by just typing cordova ?!
This seems to be a problem with the CHMOD rights of your folders. Try to own the folders like this:
sudo chown -R $USER /usr/local
sudo chmod -R 0775 /usr/local
after that, clear the npm cache with
sudo npm cache clear
finished? Go on by installing cordova again ->
sudo npm install -g cordova
type cordova into your terminal and everything should work like a charme.
Source: https://stackoverflow.com/a/19113963/3671726

Bash isn't recognizing gulp command

sudo npm install -g gulp on Ubuntu isn't allowing me to access the gulp command.
When cd into my project that has a gulpfile, and run the gulp command, nothing happens.
which gulp = /usr/bin/gulp
Anyone know what the issue could be?
EDIT :
I have installed gulp and followed the documentation yet nothing is working.
The problem lied in the paths.
Because some dependencies will use the node command instead of the nodejs command, there has to a link to the paths.
sudo ln /usr/bin/nodejs /usr/bin/node solved this for me.

Resources