yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry

Home Page:https://classic.yarnpkg.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Couldn't find the binary

adnanfajlur opened this issue · comments

image

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

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

image

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

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.

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?

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

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?

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.

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.

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?

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.

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

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.

Is this problem still relevant?

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

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.

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

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.