Reputation: 188
I try to install Cordova in macOS Mojave. I run the following command to install globally. It is installed successfully npm i -g cordova
but when I check the version using cordova --version
, It gives me the error "cordova: command not found".
and also when I try to get the location using which cordova
, It returns nothing.
Upvotes: 3
Views: 2791
Reputation: 745
Refer this great write up: http://blog.webbb.be/command-not-found-node-npm/
This can happen when npm is installing to a location that is not the standard and is not in your path.
To check where npm is installing, run:
npm root -g
It SHOULD say /usr/local/lib/node_modules
, If it doesn't then follow this:
Set it to the correct PATH:
run: npm config set prefix /usr/local
Then reinstall your npm package(s) with -g:
npm install -g cordova
etc
If this doesn't work then try adding the global path of cordova(where it got installed) to your $PATH
variable.
Upvotes: 4