Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

error message "command not found: cowsay" (Win 10) #60

Closed
seriousManual opened this issue Jul 11, 2017 · 4 comments
Closed

error message "command not found: cowsay" (Win 10) #60

seriousManual opened this issue Jul 11, 2017 · 4 comments
Labels

Comments

@seriousManual
Copy link

seriousManual commented Jul 11, 2017

this may or may be not related to #58 (i encountered the same issue, but only when running a module that has not been installed already).

when i try to reproduce the example from your blog post I get the error message from the title.
in more detail:

D:\programming\florp>cat package.json
{
  "name": "florp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "cowsay": "^1.1.9"
  }
}

D:\programming\florp>npm -v
5.2.0

D:\programming\florp>npx -v
9.0.3

D:\programming\florp>ls .\node_modules\.bin
cowsay  cowsay.cmd  cowthink  cowthink.cmd

D:\programming\florp>npx cowsay hello!
npx: command not found: cowsay

Update:
I updated to 9.0.5, the issue is still the same.

@zkat zkat added the bug label Jul 11, 2017
@zkat
Copy link
Owner

zkat commented Jul 11, 2017

I think this is likely to be the same issue, yeah.

Is this also on Powershell? I'll take a look on Windows tomorrow and see what's up. I know I've had some Windows users for a while, now.

@seriousManual
Copy link
Author

this is cmd.exe

how do you approach developing npx?
mabye i can try to take a stab at the windows issues

@katemihalikova
Copy link
Collaborator

I wasn't using npx in last few days so I didn't notice it's not working for several major versions for me :)

Tried running different versions today: running not installed packages stopped working since v6.0.0 and running both locally and globally installed packages stopped working since v6.2.0 on my box. Error message is npx: command not found: cowsay all the time.

I'm not experienced in processes and spawning etc. so it's probably a naive approach but when I set shell: true in options for require('child_process').spawn in child.js line 10/11, it started working fine (at least partially, not installed packages still fail with the #58 problem).

There is a related note in node docs:

(...) On Unix-type operating systems (Unix, Linux, macOS) child_process.execFile() can be more efficient because it does not spawn a shell. On Windows, however, .bat and .cmd files are not executable on their own without a terminal, and therefore cannot be launched using child_process.execFile(). When running on Windows, .bat and .cmd files can be invoked using child_process.spawn() with the shell option set, (...) or by spawning cmd.exe and passing the .bat or .cmd file as an argument (...).

I have Windows 10 and I've tried all of that in cmd.exe, but the results are the same for bash.exe (aka Git Bash) too. I have node 6.9.4 and tried npx 5.4.0 (works fine), 6.0.0 (not installed packages stopped working), 6.1.0, 6.2.0 (globally and locally installed packages stopped working), 7.0.0, 8.1.1, 9.0.3 (bundled), and 9.0.7 (standalone) (still not working). I tried the fix above with 8.1.1 and 9.0.7 (both bundled and standalone).

@seriousManual
Copy link
Author

works like a charm, thanks everybody! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants