What is the current behavior?
I get this output when trying to run a command from ./node_modules/.bin:
yarn run mocha -- ./test/**/**.spec.js
'.' is not recognized as an internal or external command,
If the current behavior is a bug, please provide the steps to reproduce.
yarn add --dev mocha
yarn run mocha -- ./test/**/**.spec.js
What is the expected behavior?
The command should work and not end abruptly.
Please mention your node.js, yarn and operating system version.
node 6.9.1
npm 3.8.3
Win 10
sample package.json scripts section
...
"scripts": {
"build": "./node_modules/.bin/grunt --environment=production build",
"serve": "./node_modules/.bin/grunt --environment=development serve",
"grunt": "./node_modules/.bin/grunt",
"bower": "./node_modules/.bin/bower".
"mocha": "./node_modules/.bin/mocha"
}
...
Might be a Windows issue. Working fine for me on macOS Sierra. BTW, can you please mention yarn version too 馃槃
Ah, sure and sorry, it is the latest v0.16.1
Windows indeed. Should be pretty easy fix I think, problem lies in the different path formats. See here: the run command just takes over your scripts format without normalizing it.
Possible workarounds for now are:
scripts, yarn populates the run automatically with the .bin files, so you could run those commands even without defining it in scriptsPossible fixes are:
run so they drop the ./node_modules/.binThe reason Windows uses backslashes for directory separators is because, before they supported directories, the forward slash was used for options.
./node_modules/.bin/grunt is running the . command with /node_modules, /.bin, /grunt flags.
Specifying the node_modules/.bin/ subfolder is completely unnecessary in the scripts section; it's not just yarn that looks in there first, npm does too.
Trying this with yarn v0.22.0 on Windows 10 with node v7.9.0 it works perfectly. If this isn't an issue anymore please close it otherwise please provide more details on how it's still failing so this can be fixed. 馃憤
{
"scripts": {
"build": "./node_modules/.bin/grunt --environment=production build",
"serve": "./node_modules/.bin/grunt --environment=development serve",
"grunt": "./node_modules/.bin/grunt",
"bower": "./node_modules/.bin/bower",
"mocha": "./node_modules/.bin/mocha"
},
"dependencies": {
"mocha": "^3.2.0"
}
}
C:\Users\xo\code\yarn-issue\1657>yarn run mocha -- ./test/**/**.spec.js
yarn run v0.22.0
$ ./node_modules/.bin/mocha ./test/**/**.spec.js
Warning: Could not find any test files matching pattern: ./test/**/**.spec.js
No test files found
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
It seems it got fixed
Most helpful comment
The reason Windows uses backslashes for directory separators is because, before they supported directories, the forward slash was used for options.
./node_modules/.bin/gruntis running the.command with/node_modules,/.bin,/gruntflags.Specifying the
node_modules/.bin/subfolder is completely unnecessary in thescriptssection; it's not justyarnthat looks in there first,npmdoes too.