Cli: bash: netlify: command not found"

Created on 13 Aug 2020  路  8Comments  路  Source: netlify/cli

Despite having Netlify installed locally and globally, on Windows 10 npm version 6.14.5.

When I run netlify or any command with Netlify I get this error:

$ netlify
bash: netlify: command not found"

$ npm netlify --v
6.14.5

Thanks!

unconfirmed bug

Most helpful comment

Well there is your problem. If you install it in Windows with Windows npm, then it will only be available in the Windows command prompt or PowerShell prompt.

If you want to use it in WSL, you need to install node/npm and netlify-cli in your WSL environment.

All 8 comments

Hi @katzcentrality, thank you for reporting this issue.
Do you mind sharing the output of the following command?
npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli

To run the CLI locally, you should have a script under package.json

"scripts": {
    "netlify": "netlify"
  }

Then you should be able to run npm run netlify

npm run netlify does now work with that start script - but I can't run netlify without npm run preceding it.

System:
OS: Windows 10 10.0.18362
CPU: (8) x64 Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz
Memory: 9.43 GB / 15.93 GB
Binaries:
Node: 14.5.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - ~\Desktop\Coding\voice-2\node_modules.bin\yarn.CMD
npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
npmPackages:
netlify-cli: ^2.59.0 => 2.59.0

I too am facing this issue

$ netlify deploy
bash: netlify: command not found
$  npm netlify --v
6.14.7
$ npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli
npx: installed 1 in 6.496s

  System:
    OS: Windows 10 10.0.18363
    CPU: (4) x64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
    Memory: 2.25 GB / 7.92 GB
  Binaries:
    Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.7 - C:\Program Files\nodejs\npm.CMD
$ npm run netlify

> [email protected] netlify C:\path\to\project\front
> netlify

'netlify' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] netlify: `netlify`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] netlify script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

I also get an error when running npm install netlify-cli -g

Thanks, I'll try to reproduce and update here

Quick question:

$ netlify deploy
bash: netlify: command not found

Are you installing netlify-cli in Windows and then trying to run netlify from a Bash shell?

Yep exactly.

Well there is your problem. If you install it in Windows with Windows npm, then it will only be available in the Windows command prompt or PowerShell prompt.

If you want to use it in WSL, you need to install node/npm and netlify-cli in your WSL environment.

I tried it on PowerShell as @williamjacksn suggested and it worked.

(I was not using WSL. I was using Git BASH on Windows and I have used it before to deploy)

Was this page helpful?
0 / 5 - 0 ratings