onepub-dev / dcli

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

dcli compile fails with pubGetException. the path assumed for pub and dart2native is different from actual #121

Closed lohanidamodar closed 3 years ago

lohanidamodar commented 3 years ago

@bsutton For me as i described and you can see in the output of dcli doctor the path for pub and dart2native are not in the path assumed by the dcli. And for me the problem is not during the dcli install its with dcli compile where it's unable to find the pub and pubGetException is raised as below

Setting flag: verbose
DCli Version: 0.34.6
Found command Instance of 'CompileCommand'
Setting flag: install

Compiling ./pcreate.dart...

exists: ./pcreate.dart followLinks: true
env:  SHELL:/usr/bin/zsh
env:  SHELL:/usr/bin/zsh
env:  SUDO_USER:null
path: /<path>/dart/scripts/pcreate.dart
exists: /<path>/dart/scripts/pubspec.yaml followLinks: true
lockcount = 0
Hardlock taken
exists: /<path>/dart/scripts followLinks: true
find: pwd: /home/dlohani/Documents/dart/scripts root: /<path>/dart/scripts pattern: *.script.lock caseSensitive: false recursive: false types: [file] 
found [] lock files
Taking lock .486796.2833298015332279.script.lock for isolates/2833298015332279
Lock Source: named_lock.dart : NamedLock.withLock : 104
touch: /<path>/dart/scripts/.486796.2833298015332279.script.lock create: true
exists: /<path>/dart/scripts followLinks: true
Hardlock released
Waiting for warmup to complete...
Incremented lock: 1
lockcount = 1
Incremented lock: 2
env:  SUDO_USER:null
env:  PATH:/usr/local/go/bin:/opt/flutter/bin:/opt/flutter/.pub-cache/bin:/opt/flutter/bin/cache/dart-sdk/bin:/home/dlohani/.pub-cache/bin:/home/dlohani/.dcli/bin
exists: /usr/local/go/bin/dart followLinks: true
exists: /opt/flutter/bin/dart followLinks: true
Process.start: cmdLine /opt/flutter/bin/pub get --no-precompile
Process.start: runInShell: false workingDir: /<path>/dart/scripts mode: normal cmd: /opt/flutter/bin/pub args: get, --no-precompile
exists: /home/dlohani/Documents/dart/scripts followLinks: true
pub get exeception: /opt/flutter/bin/pub get --no-precompile 
exit: 2
reason: Could not find /opt/flutter/bin/pub on the path.
Decremented lock: 1
Decremented lock: 0
Releasing lock: /<path>/dart/scripts/.486796.2833298015332279.script.lock
Hardlock taken
delete:  /<path>/dart/scripts/.486796.2833298015332279.script.lock ask: false
exists: /<path>/dart/scripts/.486796.2833298015332279.script.lock followLinks: true
Hardlock released
DCliException: Instance of 'PubGetException' 
Stacktrace: named_lock.dart : NamedLock.withLock.<anonymous closure> : 127
zone.dart : runZonedGuarded : 1620
zone.dart : runZoned : 1547
named_lock.dart : NamedLock.withLock : 104
dart_project.dart : DartProject.warmup : 126
compile.dart : CompileCommand.compileScript : 108
compile.dart : CompileCommand.run : 65
command_line_runner.dart : CommandLineRunner.process : 86
entry_point.dart : EntryPoint._parseCmdLine : 40
entry_point.dart : EntryPoint.process : 34

Originally posted by @lohanidamodar in https://github.com/bsutton/dcli/issues/120#issuecomment-748689533

lohanidamodar commented 3 years ago

@bsutton and thank you for willing to fix so soon, as I am making dart automation tutorials on My youtube channel, where I already have first episode. I was inspired to make those because I love dcli. So in the next episode I want to demonstrate compile and install. If it's fixed early as possible that would be awesome :100:

bsutton commented 3 years ago

If you have any questions happy to help.

On Mon, 21 Dec 2020 at 11:15, Damodar Lohani notifications@github.com wrote:

@bsutton https://github.com/bsutton and thank you for willing to fix so soon, as I am making dart automation tutorials on My youtube channel https://youtube.com/reactbits, where I already have first episode https://www.youtube.com/watch?v=EgBJm3TgUao. I was inspired to make those because I love dcli. So in the next episode I want to demonstrate compile and install. If it's fixed early as possible that would be awesome šŸ’Æ

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bsutton/dcli/issues/121#issuecomment-748693258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OFTI6TBZRMPQLTMDVLSV2HTXANCNFSM4VDP2NXA .

bsutton commented 3 years ago

dcli is pronounced 'd-cli' :)

On Mon, 21 Dec 2020 at 11:15, Damodar Lohani notifications@github.com wrote:

@bsutton https://github.com/bsutton and thank you for willing to fix so soon, as I am making dart automation tutorials on My youtube channel https://youtube.com/reactbits, where I already have first episode https://www.youtube.com/watch?v=EgBJm3TgUao. I was inspired to make those because I love dcli. So in the next episode I want to demonstrate compile and install. If it's fixed early as possible that would be awesome šŸ’Æ

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bsutton/dcli/issues/121#issuecomment-748693258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OFTI6TBZRMPQLTMDVLSV2HTXANCNFSM4VDP2NXA .

bsutton commented 3 years ago

If you are happy I will put up a link to your channel on the dcli documentation at

https://bsutton.gitbook.io/dcli/

On Mon, 21 Dec 2020 at 11:15, Damodar Lohani notifications@github.com wrote:

@bsutton https://github.com/bsutton and thank you for willing to fix so soon, as I am making dart automation tutorials on My youtube channel https://youtube.com/reactbits, where I already have first episode https://www.youtube.com/watch?v=EgBJm3TgUao. I was inspired to make those because I love dcli. So in the next episode I want to demonstrate compile and install. If it's fixed early as possible that would be awesome šŸ’Æ

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bsutton/dcli/issues/121#issuecomment-748693258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OFTI6TBZRMPQLTMDVLSV2HTXANCNFSM4VDP2NXA .

bsutton commented 3 years ago

I've just released dcli 0.35 which will use dart compile for version of dart 2.10 and greater.

Can you give it a try and let me know how it goes.

lohanidamodar commented 3 years ago

@bsutton only that will not resolve my issue as it also assumes pub path which is different returned by which.

Setting flag: verbose
DCli Version: 0.35.0
Found command Instance of 'CompileCommand'
Setting flag: install

Compiling ./pcreate.dart...

exists: ./pcreate.dart followLinks: true
env:  SHELL:/usr/bin/zsh
env:  SHELL:/usr/bin/zsh
env:  SUDO_USER:null
path: <path>/scripts/pcreate.dart
exists: <path>/scripts/pubspec.yaml followLinks: true
lockcount = 0
Hardlock taken
exists: <path>/scripts followLinks: true
find: pwd: <path>/scripts root: <path>/scripts pattern: *.script.lock caseSensitive: false recursive: false types: [file] 
found [] lock files
Taking lock .567683.2125011233325951.script.lock for isolates/2125011233325951
Lock Source: named_lock.dart : NamedLock.withLock : 104
touch: <path>/scripts/.567683.2125011233325951.script.lock create: true
exists: <path>/scripts followLinks: true
Hardlock released
Waiting for warmup to complete...
Incremented lock: 1
lockcount = 1
Incremented lock: 2
env:  SUDO_USER:null
env:  PATH:/usr/local/go/bin/opt/flutter/.pub-cache/bin:/opt/flutter/bin/cache/dart-sdk/bin:/home/dlohani/.pub-cache/bin:/home/dlohani/.dcli/bin
exists: /usr/local/go/bin/dart followLinks: true
exists: /home/dlohani/.npm/bin/dart followLinks: true
exists: /home/dlohani/Documents/projects/flutter/bin/dart followLinks: true
exists: /usr/local/go/bin/dart followLinks: true
exists: /home/dlohani/.npm/bin/dart followLinks: true
exists: /home/dlohani/Documents/projects/flutter/bin/dart followLinks: true
exists: /home/dlohani/.local/bin/dart followLinks: true
exists: /usr/local/sbin/dart followLinks: true
exists: /usr/local/bin/dart followLinks: true
exists: /usr/sbin/dart followLinks: true
exists: /usr/bin/dart followLinks: true
exists: /sbin/dart followLinks: true
exists: /bin/dart followLinks: true
exists: /usr/games/dart followLinks: true
exists: /usr/local/games/dart followLinks: true
exists: /snap/bin/dart followLinks: true
exists: /home/dlohani/Android/Sdk/tools/dart followLinks: true
exists: /home/dlohani/Android/Sdk/platform-tools/dart followLinks: true
exists: /opt/flutter/bin/dart followLinks: true
exists: <path>/scripts followLinks: true
Process.start: cmdLine /opt/flutter/bin/pub get --no-precompile
Process.start: runInShell: false workingDir: <path>/scripts mode: normal cmd: /opt/flutter/bin/pub args: get, --no-precompile
exists: <path>/scripts followLinks: true
pub get exeception: /opt/flutter/bin/pub get --no-precompile 
exit: 2
reason: Could not find /opt/flutter/bin/pub on the path.
Decremented lock: 1
Decremented lock: 0
Releasing lock: <path>/scripts/.567683.2125011233325951.script.lock
Hardlock taken
delete:  <path>/scripts/.567683.2125011233325951.script.lock ask: false
exists: <path>/scripts/.567683.2125011233325951.script.lock followLinks: true
Hardlock released
DCliException: Instance of 'PubGetException' 
Stacktrace: named_lock.dart : NamedLock.withLock.<anonymous closure> : 127
zone.dart : runZonedGuarded : 1620
zone.dart : runZoned : 1547
named_lock.dart : NamedLock.withLock : 104
dart_project.dart : DartProject.warmup : 126
compile.dart : CompileCommand.compileScript : 108
compile.dart : CompileCommand.run : 65
command_line_runner.dart : CommandLineRunner.process : 86
entry_point.dart : EntryPoint._parseCmdLine : 40
entry_point.dart : EntryPoint.process : 34

Output of dcli doctor

DCli version      0.35.0                                                 

OS                linux                                                  
OS Version        Linux 5.4.0-58-generic #64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020
Path separator    /                                                      

dart version      2.10.4                                                 

dcli path         /opt/flutter/bin/dcli                                  
dart exe path     /opt/flutter/bin/dart                                  
dart path         /opt/flutter/bin/dart                                   which: /opt/flutter/bin/dart                           
Using 'dart compi

pub path          /opt/flutter/bin/pub                                    which: /opt/flutter/bin/cache/dart-sdk/bin/pub         
Pub cache         /<HOME>/.pub-cache                                     

Package Config    Not Passed                                             

PATH
                  /usr/local/go/bin                                      
                  /<HOME>/.npm/bin                                       
                  /<HOME>/Documents/projects/flutter/bin                 
                  /usr/local/go/bin                                      
                  /<HOME>/.npm/bin                                       
                  /<HOME>/Documents/projects/flutter/bin                 
                  /<HOME>/.local/bin                                     
                  /usr/local/sbin                                        
                  /usr/local/bin                                         
                  /usr/sbin                                              
                  /usr/bin                                               
                  /sbin                                                  
                  /bin                                                   
                  /usr/games                                             
                  /usr/local/games                                       
                  /snap/bin                                              
                  /<HOME>/Android/Sdk/tools                              
                  /<HOME>/Android/Sdk/platform-tools                     
                  /opt/flutter/bin                                       
                  /opt/flutter/.pub-cache/bin                            
                  /opt/flutter/bin/cache/dart-sdk/bin                    
                  /<HOME>/.pub-cache/bin                                 
                  /<HOME>/.dcli/bin                                      
                  /<HOME>/Android/Sdk/tools                              
                  /<HOME>/Android/Sdk/platform-tools                     
                  /opt/flutter/bin                                       
                  /opt/flutter/.pub-cache/bin                            
                  /opt/flutter/bin/cache/dart-sdk/bin                    
                  /<HOME>/.pub-cache/bin                                 
                  /<HOME>/.dcli/bin                                      

$SHELL            /usr/bin/zsh                                           
Detected SHELL    zsh                                                    
Shell Start Scrip Not Found                                              

Dart location(s)
                  /opt/flutter/bin/dart                                  

Permissions
HOME              rwxr-xr-x <user>:<user> /<HOME> 
.dcli             rwxrwxr-x <user>:<user> /<HOME>/.dcli 
cache             rwxrwxr-x <user>:<user> /<HOME>/.dcli/cache 
templates         rwxrwxr-x <user>:<user> /<HOME>/.dcli/templates 
bsutton commented 3 years ago

I've just published 0.37 which I now believe fixes the pub path issue.

I'm now using the path returned by which rather than assuming that pub is in the sdk directory.

lohanidamodar commented 3 years ago

@bsutton awesome, 0.37 solves this issue for me. Great help. Thanks!

lohanidamodar commented 3 years ago

If you are happy I will put up a link to your channel on the dcli documentation at https://bsutton.gitbook.io/dcli/ ā€¦ On Mon, 21 Dec 2020 at 11:15, Damodar Lohani @.***> wrote: @bsutton https://github.com/bsutton and thank you for willing to fix so soon, as I am making dart automation tutorials on My youtube channel https://youtube.com/reactbits, where I already have first episode https://www.youtube.com/watch?v=EgBJm3TgUao. I was inspired to make those because I love dcli. So in the next episode I want to demonstrate compile and install. If it's fixed early as possible that would be awesome ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#121 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OFTI6TBZRMPQLTMDVLSV2HTXANCNFSM4VDP2NXA .

Hi, sure I would love to have the link posted there.