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

Yarn does not find installed executables? #5813

Open
F483 opened this issue May 13, 2018 · 8 comments
Open

Yarn does not find installed executables? #5813

F483 opened this issue May 13, 2018 · 8 comments
Assignees
Labels

Comments

@F483
Copy link

F483 commented May 13, 2018

Project Setup:

f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ ls
package.json
f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ cat package.json 
{
  "name": "test",
  "scripts": {
    "testconcurrently": "concurrently \"(echo foo)\" \"(echo bar)\""
  },
  "devDependencies": {
    "concurrently": "^3.5.1"
  }
}

Install dependencies:

f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ yarn install
yarn install v1.6.0
warning package.json: No license field
info No lockfile found.
warning test: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 1.17s.
f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ ls node_modules/.bin/
concurrent  concurrently  has-ansi  strip-ansi	supports-color	tree-kill

Yarn fails to find concurrently executable:

f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ yarn testconcurrently
yarn run v1.6.0
warning package.json: No license field
$ concurrently "(echo foo)" "(echo bar)"
bash: concurrently "(echo foo)" "(echo bar)": No such file or directory
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Running it with npm is not a problem however.

f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ npm run testconcurrently

> test@ testconcurrently /home/f483/dev/sandbox/node/testconcurrently
> concurrently "(echo foo)" "(echo bar)"

[0] foo
[1] bar
[1] (echo bar) exited with code 0
[0] (echo foo) exited with code 0

System is a fresh install of Ubuntu 18.04. I had the same issue on 16.04 (which caused me to update).

f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ yarn --version
1.6.0
f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ node --version
v9.0.0
f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ npm --version
5.5.1
@ghost ghost assigned rally25rs May 13, 2018
@ghost ghost added the triaged label May 13, 2018
@rally25rs
Copy link
Contributor

rally25rs commented May 14, 2018

I replied in Discord but I'll put the same thing here...

I wasn't able to reproduce the issue:

~/Projects/yarn-test 🐒   cat package.json
{
  "name": "test",
  "scripts": {
    "testconcurrently": "concurrently \"(echo foo)\" \"(echo bar)\""
  },
  "devDependencies": {
    "concurrently": "^3.5.1"
  }
}
~/Projects/yarn-test 🐒   yarn
yarn install v1.6.0
warning package.json: No license field
info No lockfile found.
warning test: No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 2.10s.

~/Projects/yarn-test 🐒   yarn testconcurrently
yarn run v1.6.0
warning package.json: No license field
$ concurrently "(echo foo)" "(echo bar)"
[0] foo
[1] bar
[1] (echo bar) exited with code 0
[0] (echo foo) exited with code 0
✨  Done in 0.23s.

I would check in node_modules/.bin to see if concurrently is in there. If it isn't, maybe try yarn install --force --verbose and see if there are any messages about not creating that bin link.


edit: I just noticed you did include the ls output of the .bin/ dir and concurrently was in there.

In that case, it should be found. Your output does have bash in the error output though, so I'm guessing you have your shell overidden? It should be using sh not bash so maybe something in the interaction isn't correct?

You could try yarn run env | grep \"PATH\" and see if the first part of the path includes that node_modules/.bin dir.

~/Projects/yarn-test 🐒   yarn run env | grep \"PATH\"
  "PATH": "/Users/jvalore/Projects/yarn-test/node_modules/.bin:...{rest of path omitted}

@F483
Copy link
Author

F483 commented May 14, 2018

I provided the contents of node_modules/.bin/ above, but here it is again since you missed it, together with the path information. As you can see the path of the example project is first in the list.

f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ ls node_modules/.bin
concurrent  concurrently  has-ansi  strip-ansi	supports-color	tree-kill
f483@f483-laptop:~/dev/sandbox/node/testconcurrently$ yarn run env | grep \"PATH\"
warning package.json: No license field                                                                                                                                                                     
  "PATH": "/home/f483/dev/sandbox/node/testconcurrently/node_modules/.bin:/home/f483/.config/yarn/link/node_modules/.bin:/home/f483/dev/sandbox/node/testconcurrently/node_modules/.bin:/home/f483/.config/yarn/link/node_modules/.bin:/home/f483/.yarn/bin:/home/f483/.nvm/versions/node/v9.0.0/libexec/lib/node_modules/npm/bin/node-gyp-bin:/home/f483/.nvm/versions/node/v9.0.0/lib/node_modules/npm/bin/node-gyp-bin:/home/f483/.nvm/versions/node/v9.0.0/bin/node_modules/npm/bin/node-gyp-bin:/home/f483/bin:/home/f483/bin:/home/f483/.nvm/versions/node/v9.0.0/bin:/home/f483/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/bin:/home/f483/dev/go/bin:/home/f483/Android/Sdk/tools:/home/f483/Android/Sdk/platform-tools:/home/f483/Android/Sdk/tools/bin:/bin:/home/f483/dev/go/bin:/home/f483/Android/Sdk/tools:/home/f483/Android/Sdk/platform-tools:/home/f483/Android/Sdk/tools/bin",

@kuun
Copy link

kuun commented Oct 11, 2018

The same problem on my home windows 10, but the problem is exist on my office pc (windows 10) for the same project.
yarn version: 1.10.1

But i change file extension from '.CMD' to '.cmd', the problem is vanished.

@Gudahtt
Copy link
Contributor

Gudahtt commented Oct 11, 2018

@kuun are you using the Windows Subsystem for Linux?

If so, I might know the cause: npm/node-which#59
Yarn uses node-which to find binaries, which treats the filesystem on Windows as case-insensitive. But any directories created from WSL are flagged as case-sensitive by default, which results in node-which not finding the binary.

@kuun
Copy link

kuun commented Oct 13, 2018

@Gudahtt I am sorry for the last sentence. I changed the file extension from '.cmd' to '.CMD'.

wsl is enabled on my pc. but I always use yarn in powershell.

@Gudahtt
Copy link
Contributor

Gudahtt commented Oct 14, 2018

@kuun Try running the command fsutil.exe file queryCaseSensitiveInfo <path>, where <path> is the bath to your .bin directory. That should tell you whether the case-sensitive flag is on, which would mean that's your problem. You can find more information about that flag here, including instructions on how to disable it for a specific directory.

But it sounds like this might not be the problem the OP described.

@F483 if you're still having this problem, could you list the contents of .bin again in long format (i.e. with the -l flag, to show the file permissions as well). Perhaps this is a permissions issue.

@kuun
Copy link

kuun commented Oct 20, 2018

@Gudahtt Thanks, the folder is case sensitive. maybe the git repository is cloned in wsl. I'll clone the repo in windows.

@everdimension
Copy link

@kuun Thanks for advice, just spent around 40 minutes debugging why yarn run commands do not work on a mac

Turns out the repo was cloned using WebStorm

So then I just cloned the repo normally and everything worked.

No idea what exactly web storm did wrong, but I hope this'll help someone else.

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

5 participants