Sdk: win8.1 dart command-line: find: > bin [: No such file or directory

Created on 2 Dec 2014  Â·  26Comments  Â·  Source: dart-lang/sdk

_This issue was originally filed by everton.marques...@gmail.com_


What steps will reproduce the problem?

Call one of these command-line tools from Windows 8.1:
pub
dartfmt
dartanalyzer
dart2js

Example:

C:\Users\esmarques>set DART_SDK=c:\dart\dart-sdk
C:\Users\esmarques>cd c:\tmp\devel\negentropia\wwwroot\dart
c:\tmp\devel\negentropia\wwwroot\dart>call c:\dart\dart-sdk\bin\pub get
find: > bin [: No such file or directory
Resolving dependencies...
Got dependencies!

What is the expected output?
Clean run, like previous Dart SDKs.

What do you see instead?
find: > bin [: No such file or directory

What version of the product are you using?
Build 42033
Dart Editor version 1.9.0.dev_00_00 (DEV)
Dart SDK version 1.9.0-dev.0.0

On what operating system?
64-bit Windows 8.1

P1 area-dart-cli area-sdk type-bug

All 26 comments

Everton, can you let us know in which version this worked for you? You mention it working in previous Dart SDKs. It looks like the scripts cannot locate the 'find' utility. Can you run find from the command line?

 C:> find
 C:> find.exe
 C:> where find
 C:> where find.exe

Johnni, you did a change to dart2js.bat recently but most of the other command-line tool wrappers haven't changed.


cc @johnniwinther.
_Added this to the 1.9 milestone._
_Removed Priority-Unassigned label._
_Added Priority-High, Area-SDK, Triaged labels._

The dart2js.bat in dart-sdk/bin/ hasn't changed (it runs the snapshot). The old sdk/bin/dart2js.bat was copied into sdk/bin/dart2js_sdk.bat from which dart-sdk/bin/dart2js.bat is generated.

I cannot reproduce the problem on Windows 7.

_This comment was originally written by everton.ma...@gmail.com_


Guys, I cannot reproduce this issue today on my Win8.1.
I am clueless.
I guess it might be some weirdness specific to my system.
So please feel free to disregard this issue.
Sorry for the noise.

_This comment was originally written by a.d.mu...@gmail.com_


Have the same issue on Win 7.

_This comment was originally written by dylan.kyle.p...@gmail.com_


I'm seeing this in Dart SDK version 1.8.3 and 1.9.0 in Windows 8.1 from Windows PowerShell. It works fine in CMD

_This comment was originally written by @aam_


It sounds like cygwin find.exe gets used instead of Windows system find.exe. Can you check your path environment variable("set path" in cmd shell, "gci env:" in powershell) - whether cygwin folder comes up before windows system path(comspec environment variable)?

_This comment was originally written by @seaneagan_


I am seeing this only when calling the executables from cygwin (I have 64 bit installed).

$ where find
C:\cygwin64\bin\find.exe
C:\Windows\System32\find.exe

$ where find.exe
C:\cygwin64\bin\find.exe
C:\Windows\System32\find.exe

There are other issues running from cygwin as well, see issue #20822.

_This comment was originally written by aleskv...@mailinator.com_


I have the same issue with Windows 7 32bit and Dart SDK from (cca) 1.2 to 1.8.3. I have Dart SDK installed (unzipped and added to %PATH% system variable) both for current user and globally. The problem appears only if I run e.g. dartanalyzer locally, globally this message disappears.

_Removed this from the 1.9 milestone._

_Added this to the 1.10 milestone._

_Removed this from the 1.10 milestone._
_Added this to the 1.11 milestone._

Hello guys.
I ran into the same issues and _maybe_ found the source of your errors
(I found the fix in my case.. maybe this will help you to).

The source of the problem was "find" command whichcomes with git tools.
And the path to "git tools" was set before the path to windows "find" util.
So the _git find_ was called and show up exactly this error.

To fix: I just set the path "c:\windows\system32" to appear before the "c:\git\bin"
in the windows path variable.
So windows "find" command has priority and your bat scripts starts to work as expected.

How to check : If console command "find --help" returns an error this means dos find is run
and "pub.bat & others" should work perfectly.

@genesem that sounds like something we could work around in our script.

Thoughts, @sgjesse?

One option could be to replace


with

%WINDIR%\System32\find.exe

If %WINDIR% is messed up most likely nothing will work anyway.

May I offer to use findstr command instead?
it is present only on windows platform.

This bug just happened to me on Windows 10 from cmd. I had to use @sgjesse's fix.

I can reproduce this odd behaviour in Windows 10 on the beta channel.

> flutter format lib/main.dart
"flutter format" is deprecated and will be removed in a future release, use "dart format" instead.
find: ‘> bin [’: No such file or directory
Formatted lib/main.dart

> dart format lib/main.dart
find: ‘> bin [’: No such file or directory
Unchanged lib/main.dart

> where find
C:Program FilesGitusrbinfind.exe
C:WindowsSystem32find.exe

@mit-mit @athomas - should this still be a P1?

From the comment in https://github.com/dart-lang/sdk/issues/21770#issuecomment-649906820 it sounds like this also applies to the new dart CLI tool. We should fix that one (and can skip other tools that will be deprecated for the dart tool).

Tagging for Sept., cc @jwren

I can confirm using git cl presubmit on Windows 10 also shows this error.

@franklinyow Who needs to own this issue? It has a milestone for September 2020 but no owner. If we can't find a specific owner I would suggest dropping the September 2020 milestone.

@bkonyi -- who did you mention this morning that has Windows experience?

@jwren well, _I_ have a Windows machine but I'm OOO potentially all next week. @zichangg is probably the best person to refer this to.

@zichangg has already verified that it does reproduce on a Windows 10 machine but it is not clear if it is a VM issue based on https://github.com/dart-lang/sdk/issues/21770#issuecomment-120418771

This has already been diagnosed and proposed solution(use %SystemRoot%\System32\find.exe instead of find) was implemented in _some_ bat files but not all:

./sdk/bin/dartdoc.bat:37:                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dartanalyzer.bat:63:                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dart2js.bat:53:                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dartfmt_sdk.bat:37:                                             ^| find ">     %~n1 ["`) do (
./sdk/bin/dart2js_sdk.bat:50:                                             ^| find ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dart2native.bat:36:                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dartdevc_sdk.bat:52:                                             ^| find ">     %~n1 ["`) do (
./sdk/bin/pub_sdk.bat:46:                                             ^| find ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dartdevc.bat:59:                                             ^| find ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dartanalyzer_sdk.bat:45:                                             ^| find ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dartfix.bat:37:                                             ^| find ">     %~n1 [" 2^>nul`) do (
./sdk/bin/pub.bat:49:                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
./sdk/bin/dartfmt.bat:50:                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (

What needs to be done is that the rest of .bat files have to be changed to %SystemRoot%\System32\find.exe.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nex3 picture nex3  Â·  3Comments

matanlurey picture matanlurey  Â·  3Comments

jmesserly picture jmesserly  Â·  3Comments

xster picture xster  Â·  3Comments

55555Mohit55555 picture 55555Mohit55555  Â·  3Comments