onepub-dev / dcli

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.
245 stars 28 forks source link

Issue with `dcli install` on Windows #199

Closed lucatrv closed 2 years ago

lucatrv commented 2 years ago

When I run dcli install I get the following error message:

Hang on a tick whilst we install DCli 1.34.0

RunException: /usr/bin/dart pub global activate dcli
exit: 2
reason: Could not find /usr/bin/dart on the path.
Stacktrace: wait_for_ex.dart : waitForEx : 27
runnable_process.dart : RunnableProcess._waitForStart : 307
runnable_process.dart : RunnableProcess.start : 285
runnable_process.dart : RunnableProcess.run : 174
run.dart : startFromArgs : 180
dart_sdk.dart : DartSdk.runPub : 244
pub_cache.dart : PubCache.globalActivate : 212
windows_installer.dart : WindowsDCliInstaller.install : 42
windows_mixin.dart : WindowsMixin.install : 37
install.dart : InstallCommand.run : 112
command_line_runner.dart : CommandLineRunner.process : 98
entry_point.dart : EntryPoint._parseCmdLine : 41
entry_point.dart : EntryPoint.process : 36
dcli.dart : DCli.run : 17
dcli.dart : main : 12
isolate_patch.dart : _delayEntrypointInvocation.<anonymous closure> : 295
isolate_patch.dart : _RawReceivePortImpl._handleMessage : 192

I'm on Windows 10, and I've got Flutter 3.3.2 installed under %HOMEPATH%\flutter and in my PATH. flutter doctor runs with no issues. Here is the output of dcli doctor:

DCli version      1.34.0

os                windows
os version        "Windows 10 Pro" 10.0 (Build 19044)
path separator    \

dart version      2.18.1

dcli path         C:\Users\myuser\AppData\Local\Pub\Cache\bin\dcli.bat
dart exe path     C:\usr\bin\dart
dart path         C:\usr\bin\dart                                         which: C:\Windows\System32\not found
compiler          using 'dart compile exe'

pub               using 'dart pub'

pub cache         C:\Users\myuser\AppData\Local\Pub\Cache
PUB_CACHE Env     false

package config    C:\Windows\System32\not passed

PATH
                  C:\Program Files (x86)\VMware\VMware Player\bin
                  C:\Program Files (x86)\Intel\iCLS Client
                  C:\Program Files\Intel\iCLS Client
                  C:\WINDOWS\system32
                  C:\WINDOWS
                  C:\WINDOWS\System32\Wbem
                  C:\WINDOWS\System32\WindowsPowerShell\v1.0
                  C:\Program Files (x86)\PDFtk\bin
                  C:\Program Files\Microsoft SQL Server\130\Tools\Binn
                  C:\Program Files (x86)\Intel\UCRT
                  C:\Program Files\Intel\UCRT
                  C:\Program Files (x86)\Intel\Intel(R) Management Engine
                  C:\Program Files\Intel\Intel(R) Management Engine Compo
                  C:\Program Files (x86)\Intel\Intel(R) Management Engine
                  C:\Program Files\Intel\Intel(R) Management Engine Compo
                  C:\Program Files\Intel\WiFi\bin
                  C:\Program Files\Common Files\Intel\WirelessCommon
                  C:\Program Files\Microsoft VS Code\bin
                  C:\Program Files\Microsoft SQL Server\110\Tools\Binn
                  C:\WINDOWS\System32\WindowsPowerShell\v1.0
                  C:\Program Files (x86)\Sennheiser\SenncomSDK
                  C:\WINDOWS\System32\OpenSSH
                  C:\Program Files\dotnet
                  C:\Strawberry\c\bin
                  C:\Strawberry\perl\site\bin
                  C:\Strawberry\perl\bin
                  C:\Program Files\PowerShell\7
                  C:\Users\myuser\.cargo\bin
                  C:\Users\myuser\AppData\Local\Programs\Python\Python3
                  C:\Users\myuser\AppData\Local\Programs\Python\Python3
                  C:\Program Files\gnuplot\bin
                  C:\cmder\vendor\git-for-windows\cmd
                  c:\users\myuser\.local\bin
                  C:\Users\myuser\AppData\Local\Microsoft\WindowsApps
                  c:\users\myuser\appdata\roaming\python\python310\scri
                  C:\Users\myuser\flutter\bin
                  C:\Users\myuser\AppData\Local\Pub\Cache\bin
                  C:\<HOME>\.dcli\bin

Shell Settings
$SHELL
detected          cmd.exe
Start sript       not supported by shell

dart location(s)
                  C:\Users\myuser\flutter\bin\dart

permissions
HOME              rwxrwxrwx <user>:<user> C:\<HOME>
.dcli             C:\<HOME>\.dcli does not exist
project template  C:\<HOME>\.dcli\template\project does not exist
script template   C:\<HOME>\.dcli\template\script does not exist
pub cache         rwxrwxrwx <user>:<user> C:\Users\myuser\AppData\Local\Pub\Cache

Apparently dcli is looking for dart in \usr\bin.

bsutton commented 2 years ago

can you run: where flutter dart

and report back with the results

bsutton commented 2 years ago

sorry the command should be:

where.exe flutter dart

bsutton commented 2 years ago

I think I understand the problem.

Can you install 2.0.0-beta.9

dart pub global activate dcli --version 2.0.0-beta.9

then try the install again.

lucatrv commented 2 years ago

The installation works now, thanks! But then when I run dcli create --template=full myproject I get the following error...

Creating myproject from template C:\Users\myuser\AppData\Roaming\.dcli\template\project\full.

    C:\myproject\analysis_options.yaml
    C:\myproject\CHANGELOG.md
    C:\myproject\pubspec.lock
    C:\myproject\pubspec.yaml
    C:\myproject\README.md
    C:\myproject\bin\myproject.dart
    C:\myproject\lib\src\args\global_args.dart
    C:\myproject\lib\src\args\usage.dart
    C:\myproject\lib\src\commands\config.dart
    C:\myproject\lib\src\commands\install.dart
    C:\myproject\lib\src\commands\run.dart
    C:\myproject\lib\src\commands\view.dart
    C:\myproject\lib\src\exceptions\app_exception.dart
    C:\myproject\lib\src\settings\app_settings.dart

RunException: /usr/bin/dart pub get --no-precompile
exit: 2
reason: Could not find /usr/bin/dart on the path.
Stacktrace: wait_for_ex.dart : waitForEx : 27
runnable_process.dart : RunnableProcess._waitForStart : 307
runnable_process.dart : RunnableProcess.start : 285
runnable_process.dart : RunnableProcess.run : 174
run.dart : startFromArgs : 180
dart_sdk.dart : DartSdk.runPub : 244
dart_sdk.dart : DartSdk.runPubGet : 378
dart_project_creator.dart : _createProject : 50
dart_project.dart : new DartProject.create : 57
create.dart : CreateCommand.run : 87
command_line_runner.dart : CommandLineRunner.process : 98
entry_point.dart : EntryPoint._parseCmdLine : 41
entry_point.dart : EntryPoint.process : 36
dcli.dart : DCli.run : 17
dcli.dart : main : 12
isolate_patch.dart : _delayEntrypointInvocation.<anonymous closure> : 295
isolate_patch.dart : _RawReceivePortImpl._handleMessage : 192
bsutton commented 2 years ago

can you run:

dcli doctor

and report the results.

It feels like you are running the old version of dcli, as this code uses the same logic as the install but you are getting the old behaviour.

also can your run

dcli -v create --template=full myproject

and report the results.

lucatrv commented 2 years ago

Yes sorry, for some reason it was reverted back to version 1.34.0, now I activated version 2.0.0-beta.9 again and it works, thanks!

SzczurekYT commented 1 year ago

Yep, using the beta version also fixed my issues with installation.

bsutton commented 1 year ago

There is also a problem with the mac install. I have a fix almost ready for this as well.