I am currently using MacOS and am trying to install wrangler using npm i @cloudflare/wrangler -g . It tells me that Wrangler was installed correctly, but when I attempt to use wrangler it tells me zsh: command not found: wrangler.
How can I fix this?
Thank you
Have you solved your problem?
First of all: npm adds to $PATH
the folder with binaries or scripts to launch them.
In windows it's ~\AppData\Roaming\npm
, on linux it's /tools/node/bin
etc.
Check your $PATH variable for something like "node" or "npm" or run 'npm list -g --depth=0' - the path to target location will be on first line of output.
If other globally installed packages works fine then check if npm folder contain any script related to wrangler. Maybe the problem is that wrangler was not installed correctly and related script was not added. Then try to reinstall. Or probably you can write this script by yourself.
Finaly note that wrangler binary(not script to launch it) is installed to ~/.wrangler
folder (according to node_modules/@cloudflare/wrangler/binary.js
)
If you will try to make your own script to run that you need:
npm list -g --depth=0
and get the path from first line of outputnode_modules
cd node_modules/@cloudflare/wrangler
node run-wrangler.js
will not throw any errors (output is just wrangler "how to use")node install-wrangler.js
- this should download wrangler binary to ~/.wrangler
and retry step 4node /path/to/the/run-wrangler.js
and passing your args to it.