Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't find the binary #6048

Closed
adnanfajlur opened this issue Jun 29, 2018 · 21 comments
Closed

Couldn't find the binary #6048

adnanfajlur opened this issue Jun 29, 2018 · 21 comments
Assignees
Labels

Comments

@adnanfajlur
Copy link

image

Couldn't find the binary.. after run npm clean, and if i run with npm run dev it still can not

@ghost ghost assigned arcanis Jun 29, 2018
@ghost ghost added the triaged label Jun 29, 2018
@shabith
Copy link

shabith commented Jul 9, 2018

@adnanfajlur Did you find a solution for this? I'm getting the same error.

@adnanfajlur
Copy link
Author

image

use ubuntu bash on windows,
i think the problem is in path

@shabith
Copy link

shabith commented Jul 9, 2018

Thanks @adnanfajlur. you are right it was a issue with cmd. So I check with git bash and now I'm getting a different error.
/d: /d: Is a directory
I think it is also related to problem with the path.

@stowellt
Copy link

stowellt commented Aug 8, 2018

This isn't working because an empty array [] is passed into the spawn() function for the arguments parameter i.e.
yarn/src/util/execute-lifecycle-script.js
const stdout = await child.spawn(cmd, [], {cwd, env, stdio, detached, shell}, onProgress);

I'm not sure why that array is empty. Are the arguments supposed to be passed another way?

@blowsie
Copy link

blowsie commented Sep 19, 2018

I have the same issue when running a simple npm script

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "copy": "cpx  \"src/products/**.*\" dist/products --verbose"
  }

Yarn

error Couldn't find the binary cpx

Npm

Success

@richardsengers
Copy link

Exact same issue from ... yeasterday all was fine, today I can't run scripts with yarn. NPM is working just fine.

I'm o a Windows 10 x64 machine.
What should we change to the Path?

@justinmeiners
Copy link

justinmeiners commented Sep 20, 2018

I have this problem is well.

On windows I have set a custom shell (git bash) with yarn config set and npm config set
NPM works, but yarn does not.

screenshot from 2018-09-20 09-40-30

I suspect it has to do with the space in "Program Files". Let me know if you need more details.

@shabith
Copy link

shabith commented Sep 21, 2018

Hi All, I got a fix for my error in another issue #6086 (comment)
Please have a look at this reply and see if it helps you with your problem.

@richardsengers
Copy link

richardsengers commented Sep 21, 2018

Thank you so much for the link @shabith ... works again

In short ... open your ~.npmrc file and remove the line

shell-script=bash

The only weird thing is it was working just fine one day and the other day we got stuck with yarn not running any command, without updating yarn nor node

Could a windows update be the problem to this?

@shabith
Copy link

shabith commented Sep 21, 2018

I don't think it is related to windows update @richardsengers. But it could be related to node update. Anyway I'm glad it is working again.

@anargu
Copy link

anargu commented Feb 20, 2019

I had the same issue. In my case I removed yarn.lock then I tested again and it worked!. You may have a try deleting yarn.lock. Maybe yarn requires git in certain dependencies declared in yarn.lock

@tqwewe
Copy link

tqwewe commented Jul 24, 2019

I'm not able to fix it :/ I've tried deleting my yarn lock files, that didnt work.. I also tried removing the shell-script=bash in my .npmrc file but that wasnt even there.

@zakrodionov
Copy link

Is this problem still relevant?

@sodiray
Copy link

sodiray commented Dec 26, 2020

I may have a solid reproduction of this. I was just throwing a function I use often into its own package and I did the normal setup but ran into this issue where yarn can't find items installed and existing in the .bin dir.

Issue

This is the test script I usually use

c8 inforce --targetPath ./test

Screen Shot 2020-12-25 at 11 52 47 PM

I double checked the node_modules/.bin dir exists and contains all the files it should. Kind of prove this below with the work around.

Workaround

This is the workaround I'm having to go with for now.

./node_modules/.bin/c8 ./node_modules/.bin/inforce --targetPath ./test

You can see -- and hopefully reproduce -- here.

The Deets

  • yarn version: 1.22.10
  • OS: Mac OS X - Catalina - 10.15.7

@UpasnaGandhi
Copy link

Thank You @richardsengers for short answer 👍 I am beginner and this helped me. I was struggling from last 2 days. @shabith For sharing the issue details with the link. That helps.

@adnanfajlur
Copy link
Author

done

@abdfatah99
Copy link

the problem with mine is when i try to add script-shell, later it becomes unrecognizeable then i got the same issue "couldn't fine the binary",
I already solve the problem by remove the script-shell config using yarn config delete script-shell

@Jefdeniel
Copy link

Jefdeniel commented Mar 25, 2024

Had this issue after installing Playwright in my React project.

When i tried to run yarn exec playwright test i got the "Couldn't find the binary"

But when running npm exec playwright test, everything worked.

@sgd2z
Copy link

sgd2z commented Jul 17, 2024

Had this issue after installing Playwright in my React project.

When i tried to run yarn exec playwright test i got the "Couldn't find the binary"

But when running npm exec playwright test, everything worked.

I'm having this same problem.

@debdutdeb
Copy link

just chiming in, same issue happening with webpack binary. nothing more to add im afraid for now. symptoms the same as others. idk what to try to provide more info.

@Huaoe
Copy link

Huaoe commented Nov 20, 2024

I had this problem also ;)

why can't I use npx ?

The issue with npx on Windows is related to how it handles script execution and path resolution. Let's verify the npx installation and try to diagnose the specific issue:

Ran terminal command
c:/Users/thoma/Desktop/WorkspacesToken/blockchain-real-estate

where npx

Stdout
CopyInsert
C:\Program Files\nodejs\npx
C:\Program Files\nodejs\npx.cmd
Let me check your npm configuration:

Ran terminal command
c:/Users/thoma/Desktop/WorkspacesToken/blockchain-real-estate

npm config list

Stdout
CopyInsert
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\Users\thoma\AppData\Roaming\npm"

; "user" config from C:\Users\thoma.npmrc

script-shell = "="

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v22.10.0
; npm local prefix = c:\Users\thoma\Desktop\WorkspacesToken\blockchain-real-estate
; npm version = 10.9.0
; cwd = c:\Users\thoma\Desktop\WorkspacesToken\blockchain-real-estate
; HOME = C:\Users\thoma
; Run npm config ls -l to show all defaults.
Ah! I found the issue. In your npm configuration, there's a problematic setting:

Code
CopyInsert
script-shell = "="
This is causing the ENOENT error we saw earlier. Let's fix this by removing this incorrect configuration:

Ran terminal command
c:/Users/thoma/Desktop/WorkspacesToken/blockchain-real-estate

npm config delete script-shell

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

No branches or pull requests