cli icon indicating copy to clipboard operation
cli copied to clipboard

bash: netlify: command not found"

Open katzcentrality opened this issue 4 years ago • 27 comments

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!

katzcentrality avatar Aug 13 '20 03:08 katzcentrality

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

erezrokah avatar Aug 13 '20 07:08 erezrokah

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

katzcentrality avatar Aug 13 '20 13:08 katzcentrality

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

RaglandCodes avatar Aug 13 '20 15:08 RaglandCodes

Thanks, I'll try to reproduce and update here

erezrokah avatar Aug 13 '20 15:08 erezrokah

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?

williamjacksn avatar Aug 14 '20 17:08 williamjacksn

Yep exactly.

katzcentrality avatar Aug 14 '20 19:08 katzcentrality

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.

williamjacksn avatar Aug 14 '20 20:08 williamjacksn

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)

RaglandCodes avatar Aug 15 '20 06:08 RaglandCodes

im having the same problem and realllllly cant figure this shit out.. its infuriating me tbh.

bobgravity1 avatar Dec 11 '20 16:12 bobgravity1

I was having the same problem. Just run the same command while prefixing npm run. For example if you want to do netlify deploy, then write "npm run netlify deploy". Worked for me :)

1devansh avatar Jan 08 '21 16:01 1devansh

  1. npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli
npx: installed 1 in 78.577s
(node:8184) UnhandledPromiseRejectionWarning: Error: Command failed: wmic os get Caption
'wmic' is not recognized as an internal or external command,
operable program or batch file.


    at b (C:\Users\ELCOT\AppData\Roaming\npm-cache\_npx\8184\node_modules\envinfo\dist\envinfo.js:1:95039)
    at Function.e.exports.sync (C:\Users\ELCOT\AppData\Roaming\npm-cache\_npx\8184\node_modules\envinfo\dist\envinfo.js:1:96902)
    at e.exports (C:\Users\ELCOT\AppData\Roaming\npm-cache\_npx\8184\node_modules\envinfo\dist\envinfo.js:1:93256)
    at e.exports (C:\Users\ELCOT\AppData\Roaming\npm-cache\_npx\8184\node_modules\envinfo\dist\envinfo.js:1:92403)
    at C:\Users\ELCOT\AppData\Roaming\npm-cache\_npx\8184\node_modules\envinfo\dist\envinfo.js:1:91153
    at async Promise.all (index 0)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8184) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8184) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

----------------------------------------------
2)    C:\Users\ELCOT>netlify logout
'netlify' is not recognized as an internal or external command,
operable program or batch file.

-------------------------------
3)    C:\Users\ELCOT>netlify login
'netlify' is not recognized as an internal or external command,
operable program or batch file.

-----------------------------------------
4)   C:\Users\ELCOT>netlify status
'netlify' is not recognized as an internal or external command,
operable program or batch file.

ishaquee avatar Jan 26 '21 17:01 ishaquee

npm install netlify-cli -g

npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
C:\Users\ELCOT\AppData\Roaming\npm\netlify -> C:\Users\ELCOT\AppData\Roaming\npm\node_modules\netlify-cli\bin\run
C:\Users\ELCOT\AppData\Roaming\npm\ntl -> C:\Users\ELCOT\AppData\Roaming\npm\node_modules\netlify-cli\bin\run

> [email protected] postinstall C:\Users\ELCOT\AppData\Roaming\npm\node_modules\netlify-cli
> node ./scripts/postinstall.js


Success! Netlify CLI has been installed!

Your device is now configured to use Netlify CLI to deploy and manage your Netlify sites.

Next steps:

  netlify init     Connect or create a Netlify site from current directory
  netlify deploy   Deploy the latest changes to your Netlify site

For more information on the CLI run netlify help
Or visit the docs at https://cli.netlify.com

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\netlify-cli\node_modules\rollup\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-darwin-x64@^0.27.10 (node_modules\netlify-cli\node_modules\@netlify\traffic-mesh-agent\node_modules\@netlify\traffic-mesh-agent-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/[email protected]: wanted {"os":"darwin","arch":"x64"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-linux-x64@^0.27.10 (node_modules\netlify-cli\node_modules\@netlify\traffic-mesh-agent\node_modules\@netlify\traffic-mesh-agent-linux-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/[email protected]: wanted {"os":"linux","arch":"x64"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules\netlify-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @octokit/[email protected] requires a peer of @octokit/core@>=3 but none is installed. You must install peer dependencies yourself.

+ [email protected]
added 23 packages from 19 contributors and updated 15 packages in 365.776s
-------------------------------------------------

C:\Users\ELCOT>node --version
v13.14.0

----------------------------------------------------------

C:\Users\ELCOT>npm --version
6.14.10

I tried all possible methods to install netlify cli. But i am not able to use netlify cli. Any one help me there ?

ishaquee avatar Jan 26 '21 17:01 ishaquee

Hi @ishaquee, a possible workaround would be to install netlify-cli locally in your project.

npm install --save-dev netlify-cli

The add the following script to your package.json

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

Then try running npm run netlify.

erezrokah avatar Jan 26 '21 18:01 erezrokah

Where is the Package.json file located? I can't find it anywhere

On Tue, 26 Jan, 2021, 11:41 pm Erez Rokah, [email protected] wrote:

Hi @ishaquee https://github.com/ishaquee, a possible workaround would be to install netlify-cli locally in your project.

npm install --save-dev netlify-cli

The add the following script to your package.json

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

Then try running npm run netlify.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/netlify/cli/issues/1088#issuecomment-767729027, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO4J4FQ2K7FMBGZLZAV6XHLS34AWFANCNFSM4P5WEL3Q .

ishaquee avatar Jan 27 '21 03:01 ishaquee

Hi @ishaquee you can read more about package.json here. Usually you'd generate it by running npm init in the root directory of your project.

erezrokah avatar Jan 27 '21 10:01 erezrokah

npm install --save-dev netlify-cli npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline? ct.

[email protected] postinstall E:\qprofile\ishaquemohamed5-ME_QPROFILE\node_modules\netlify-cli node ./scripts/postinstall.js

Success! Netlify CLI has been installed!

Your device is now configured to use Netlify CLI to deploy and manage your Netlify sites.

Next steps: urself. npm WARN [email protected] No description

  • [email protected] added 21 packages from 29 contributors, updated 21 packages and audited 1284 packages in 1588.059s

6 packages are looking for funding run npm fund for details

found 0 vulnerabilities

E:\qprofile\ishaquemohamed5-ME_QPROFILE>npm run netlify

[email protected] netlify E:\qprofile\ishaquemohamed5-ME_QPROFILE netlify

⬥ Netlify CLI Read the docs: https://www.netlify.com/docs/cli Support and bugs: https://github.com/netlify/cli/issues

Netlify command line tool

VERSION netlify-cli/3.4.3 win32-x64 node-v13.14.0

USAGE $ netlify [COMMAND]

COMMANDS addons (Beta) Manage Netlify Add-ons api Run any Netlify API method build (Beta) Build on your local machine deploy Create a new deploy from the contents of a folder dev Local dev server env (Beta) Control environment variables for the current site functions Manage netlify functions help display help for netlify init Configure continuous deployment for a new or existing site link Link a local repo or project folder to an existing site on Netlify login Login to your Netlify account open Open settings for the site linked to the current folder plugins list installed plugins sites Handle various site operations status Print status information switch Switch your active Netlify account unlink Unlink a local folder from a Netlify site watch Watch for site deploy to finish

E:\qprofile\ishaquemohamed5-ME_QPROFILE>$ netlify login '$' is not recognized as an internal or external command, operable program or batch file.

E:\qprofile\ishaquemohamed5-ME_QPROFILE>netlify login 'netlify' is not recognized as an internal or external command, operable program or batch file.

On Wed, 27 Jan 2021 at 16:23, Erez Rokah [email protected] wrote:

Hi @ishaquee https://github.com/ishaquee you can read more about package.json here https://docs.npmjs.com/cli/v6/configuring-npm/package-json. Usually you'd generate it by running npm init https://docs.npmjs.com/cli/v6/commands/npm-init in the root directory of your project.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/netlify/cli/issues/1088#issuecomment-768203119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO4J4FSMZEIT2XAPRLWDU2LS37WCJANCNFSM4P5WEL3Q .

ishaquee avatar Jan 27 '21 13:01 ishaquee

npm run netlify

[email protected] netlify C:\Users\ELCOT netlify

⬥ Netlify CLI Read the docs: https://www.netlify.com/docs/cli Support and bugs: https://github.com/netlify/cli/issues

Netlify command line tool

VERSION netlify-cli/3.4.3 win32-x64 node-v13.14.0

USAGE $ netlify [COMMAND]

COMMANDS addons (Beta) Manage Netlify Add-ons api Run any Netlify API method build (Beta) Build on your local machine deploy Create a new deploy from the contents of a folder dev Local dev server env (Beta) Control environment variables for the current site functions Manage netlify functions help display help for netlify init Configure continuous deployment for a new or existing site link Link a local repo or project folder to an existing site on Netlify login Login to your Netlify account open Open settings for the site linked to the current folder plugins list installed plugins sites Handle various site operations status Print status information switch Switch your active Netlify account unlink Unlink a local folder from a Netlify site watch Watch for site deploy to finish

On Wed, 27 Jan 2021 at 18:54, Mohamed Ishaque [email protected] wrote:

npm install --save-dev netlify-cli npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline? ct.

[email protected] postinstall E:\qprofile\ishaquemohamed5-ME_QPROFILE\node_modules\netlify-cli node ./scripts/postinstall.js

Success! Netlify CLI has been installed!

Your device is now configured to use Netlify CLI to deploy and manage your Netlify sites.

Next steps: urself. npm WARN [email protected] No description

  • [email protected] added 21 packages from 29 contributors, updated 21 packages and audited 1284 packages in 1588.059s

6 packages are looking for funding run npm fund for details

found 0 vulnerabilities

E:\qprofile\ishaquemohamed5-ME_QPROFILE>npm run netlify

[email protected] netlify E:\qprofile\ishaquemohamed5-ME_QPROFILE netlify

⬥ Netlify CLI Read the docs: https://www.netlify.com/docs/cli Support and bugs: https://github.com/netlify/cli/issues

Netlify command line tool

VERSION netlify-cli/3.4.3 win32-x64 node-v13.14.0

USAGE $ netlify [COMMAND]

COMMANDS addons (Beta) Manage Netlify Add-ons api Run any Netlify API method build (Beta) Build on your local machine deploy Create a new deploy from the contents of a folder dev Local dev server env (Beta) Control environment variables for the current site functions Manage netlify functions help display help for netlify init Configure continuous deployment for a new or existing site link Link a local repo or project folder to an existing site on Netlify login Login to your Netlify account open Open settings for the site linked to the current folder plugins list installed plugins sites Handle various site operations status Print status information switch Switch your active Netlify account unlink Unlink a local folder from a Netlify site watch Watch for site deploy to finish

E:\qprofile\ishaquemohamed5-ME_QPROFILE>$ netlify login '$' is not recognized as an internal or external command, operable program or batch file.

E:\qprofile\ishaquemohamed5-ME_QPROFILE>netlify login 'netlify' is not recognized as an internal or external command, operable program or batch file.

On Wed, 27 Jan 2021 at 16:23, Erez Rokah [email protected] wrote:

Hi @ishaquee https://github.com/ishaquee you can read more about package.json here https://docs.npmjs.com/cli/v6/configuring-npm/package-json. Usually you'd generate it by running npm init https://docs.npmjs.com/cli/v6/commands/npm-init in the root directory of your project.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/netlify/cli/issues/1088#issuecomment-768203119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO4J4FSMZEIT2XAPRLWDU2LS37WCJANCNFSM4P5WEL3Q .

ishaquee avatar Jan 27 '21 13:01 ishaquee

That's great progress. How about npm run netlify login ?

erezrokah avatar Jan 27 '21 13:01 erezrokah

Please Help Me Solve This ?

E:\qprofile\ishaquemohamed5-ME_QPROFILE\profile-frontend>npm run-script build npm ERR! missing script: build

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ELCOT\AppData\Roaming\npm-cache_logs\2021-01-27T14_35_46_982Z-debug.log

On Wed, 27 Jan 2021 at 19:12, Erez Rokah [email protected] wrote:

That's great progress. How about npm run netlify login ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/netlify/cli/issues/1088#issuecomment-768293012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO4J4FQCH25HI3QYPI3XLT3S4AJ4JANCNFSM4P5WEL3Q .

ishaquee avatar Jan 27 '21 14:01 ishaquee

Hi @ishaquee this seems off topic for the issue. I suggest you post it in our community

erezrokah avatar Jan 27 '21 14:01 erezrokah

Hi @erezrokah I have followed your instructions and Im still facing the same issue "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "netlify": "netlify" }, have even added dev_dependecnies "devDependencies": { "netlify-cli": "^3.8.0" } when I try exe cmd netlify init it throws error zsh: command not found: netlify

kiranacharya26 avatar Feb 14 '21 18:02 kiranacharya26

Netlify deploy settings:

add build command : CI= npm run build

RajshekharChallapu avatar Apr 21 '21 23:04 RajshekharChallapu

i fixed it by adding "netlify": "netlify", in my package.json file under the "scripts" clause.

mariyambukhari avatar Nov 09 '21 17:11 mariyambukhari

Hi @ishaquee, a possible workaround would be to install netlify-cli locally in your project.

npm install --save-dev netlify-cli

The add the following script to your package.json

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

Then try running npm run netlify.

This should be added to the documentation...

Installing per project and not GLOBALLY:

Install:

npm install netlify-cli --save-dev

Add to package.json:

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

Running Netlify commands (per project):

npm run netlify <command>

ie-mecklund avatar Aug 24 '22 13:08 ie-mecklund

in my case it only if i logout and loggedin or reboot system otherwise it's very hard to run on windows 10, windows 11 because terminal/cmd keep running in Background so even install it won't work because cmd/terminal is in use and system is depends on it if stopped auto shutdown like situation will occur

developerTested avatar Jul 31 '23 14:07 developerTested

"netlify": "netlify"

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.

This worked for me! appreciate.

shemavalentin avatar Apr 14 '24 07:04 shemavalentin