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

dshell install permission issues #45

Closed andresaraujo closed 5 months ago

andresaraujo commented 4 years ago

I'm trying to install dshell in mac OS Mojave, but I get an Dart SDK not found! of type _Exception error, seems that _detect method doesn't support mac OS.

bsutton commented 4 years ago

Can you provide details of what you where doing?

dennougorilla commented 4 years ago

same error

dshell: Exception occured: FileSystemException: Deletion failed, path = '/Users/dennougorilla/.dshell/cache' (OS Error: Permission denied, errno = 13) of type DShellException
dshell: Stacktrace: waitForEx.dart : waitForEx : 37
project_cache.dart : ProjectCache.cleanAll : 91
clean_all.dart : CleanAllCommand.run : 12
install.dart : InstallCommand.run : 73
command_line_runner.dart : CommandLineRunner.process : 81
entry_point.dart : EntryPoint._parseCmdLine : 37
entry_point.dart : EntryPoint.process : 31
dshell.dart : DShell.run : 9
dshell.dart : main : 4
isolate_patch.dart : _startIsolate.<anonymous closure> : 305
bsutton commented 4 years ago

So what is the permissions the .dshell directory?

Did you run the install using sudo?

On Wed, 22 Jan 2020, 6:29 pm dennougorilla, notifications@github.com wrote:

same error

dshell: Exception occured: FileSystemException: Deletion failed, path = '/Users/dennougorilla/.dshell/cache' (OS Error: Permission denied, errno = 13) of type DShellException dshell: Stacktrace: waitForEx.dart : waitForEx : 37 project_cache.dart : ProjectCache.cleanAll : 91 clean_all.dart : CleanAllCommand.run : 12 install.dart : InstallCommand.run : 73 command_line_runner.dart : CommandLineRunner.process : 81 entry_point.dart : EntryPoint._parseCmdLine : 37 entry_point.dart : EntryPoint.process : 31 dshell.dart : DShell.run : 9 dshell.dart : main : 4 isolate_patch.dart : _startIsolate. : 305

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bsutton/dshell/issues/45?email_source=notifications&email_token=AAG32OHZU47IARQLYB6OPOLQ67YT7A5CNFSM4KIVDFEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJSQHMA#issuecomment-577045424, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OBEM3HRODBBM2EPVIDQ67YT7ANCNFSM4KIVDFEA .

bsutton commented 4 years ago

I've just released a new dev release of dshell:

dshell: ^1.1.0-dev.1

Can you install the new version and then from the cli run:

dshell doctor

Then paste the output here.

bsutton commented 4 years ago

FYI to install a dev version run:

pub global activate dshell 1.1.0-dev.1
andresaraujo commented 4 years ago

Using dshell 1.1.0-dev.1 got the same permission issue when trying to run dshell create or trying to run the script. (I ran dshell install with sudo).

dshell: Exception occured: FileSystemException: Creation failed, path = '/Users/myusername/.dshell/cache/Users' (OS Error: Permission denied, errno = 13) of type FileSystemException
dshell: Stacktrace: directory_impl.dart : _Directory.createSync : 140
directory_impl.dart : _Directory.createSync : 135
directory_impl.dart : _Directory.createSync : 135
directory_impl.dart : _Directory.createSync : 135
directory_impl.dart : _Directory.createSync : 135
directory_impl.dart : _Directory.createSync : 135
file_helper.dart : createDir : 24
virtual_project.dart : VirtualProject.createProject : 81
project_cache.dart : ProjectCache.createProject : 70
create.dart : CreateCommand.run : 29

Permissions

.dshell   : rwxr-xr-x 6:myusername   /Users/myusername/.dshell
cache     : rwxr-xr-x 2:root   /Users/myusername/.dshell/cache
dependencies.yaml: rw-r--r-- 1:myusername   /Users/myusername/.dshell/dependencies.yaml
templates : rwxr-xr-x 2:myusername   /Users/myusername/.dshell/templates
andresaraujo commented 4 years ago

ok I wiped out the .dshell directory and reintalled the dev.1 version then sudo dshell install, now got this:

dshell: Exception occured: FileSystemException: Cannot open file, path = '/etc/path.d/dshell' (OS Error: No such file or directory, errno = 2) of type FileSystemException
dshell: Stacktrace: file_impl.dart : _File.throwIfError : 645
file_impl.dart : _File.openSync : 489
file_sync.dart : FileSync._open : 26
file_sync.dart : new FileSync : 20
string_as_process.dart : StringAsProcess.write : 188
install.dart : InstallCommand.addBinToPath : 141
install.dart : InstallCommand.run : 83
command_line_runner.dart : CommandLineRunner.process : 81
entry_point.dart : EntryPoint._parseCmdLine : 37
entry_point.dart : EntryPoint.process : 31

Will try to figure out over the weekend when I have some free time

bsutton commented 4 years ago

Delete the .dshell directory and run dshell install without sudo.

On Thu, 23 Jan 2020, 2:21 am Andres Araujo, notifications@github.com wrote:

Using dshell 1.1.0-dev.1 got the same permission issue when trying to run dshell create or trying to run the script. (I ran dshell install with sudo).

dshell: Exception occured: FileSystemException: Creation failed, path = '/Users/myusername/.dshell/cache/Users' (OS Error: Permission denied, errno = 13) of type FileSystemException dshell: Stacktrace: directory_impl.dart : _Directory.createSync : 140 directory_impl.dart : _Directory.createSync : 135 directory_impl.dart : _Directory.createSync : 135 directory_impl.dart : _Directory.createSync : 135 directory_impl.dart : _Directory.createSync : 135 directory_impl.dart : _Directory.createSync : 135 file_helper.dart : createDir : 24 virtual_project.dart : VirtualProject.createProject : 81 project_cache.dart : ProjectCache.createProject : 70 create.dart : CreateCommand.run : 29

Permissions

.dshell : rwxr-xr-x 6:myusername /Users/myusername/.dshell cache : rwxr-xr-x 2:root /Users/myusername/.dshell/cache dependencies.yaml: rw-r--r-- 1:myusername /Users/myusername/.dshell/dependencies.yaml templates : rwxr-xr-x 2:myusername /Users/myusername/.dshell/templates

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bsutton/dshell/issues/45?email_source=notifications&email_token=AAG32OE2OV25AYFZTLP5LFDQ7BP7LA5CNFSM4KIVDFEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJT7BCQ#issuecomment-577237130, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OGR6ZGK3H2VHW6IPK3Q7BP7LANCNFSM4KIVDFEA .

bsutton commented 4 years ago

This looks like a bug in 1.1 can you send me the dshell doctor output.

On Thu, 23 Jan 2020, 2:30 am Andres Araujo, notifications@github.com wrote:

ok I wiped out the .dshell directory and reintalled the dev.1 version then sudo dshell install, now got this:

dshell: Exception occured: FileSystemException: Cannot open file, path = '/etc/path.d/dshell' (OS Error: No such file or directory, errno = 2) of type FileSystemException dshell: Stacktrace: file_impl.dart : _File.throwIfError : 645 file_impl.dart : _File.openSync : 489 file_sync.dart : FileSync._open : 26 file_sync.dart : new FileSync : 20 string_as_process.dart : StringAsProcess.write : 188 install.dart : InstallCommand.addBinToPath : 141 install.dart : InstallCommand.run : 83 command_line_runner.dart : CommandLineRunner.process : 81 entry_point.dart : EntryPoint._parseCmdLine : 37 entry_point.dart : EntryPoint.process : 31

Will try to figure out over the weekend when I have some free time

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bsutton/dshell/issues/45?email_source=notifications&email_token=AAG32OHPP46QHPFDQD67LSTQ7BQ7RA5CNFSM4KIVDFEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJUABXY#issuecomment-577241311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OAJGWM4WRJ62EMPVJTQ7BQ7RANCNFSM4KIVDFEA .

bsutton commented 4 years ago

I think I've worked out the problem. I've pushed a fix in 1.1.1-dev.1.

Can you give it a test. Unfortunately I don't have access to mac for testing.

pub global activate dshell 1.1.1-dev.1

andresaraujo commented 4 years ago

Thanks @bsutton, I got it working (in 1.1.0+).

The issue was that if your run dshell install with sudo you will need to run every command with sudo. The work around is to delete .dshell/ directory and just export the bin directory after dshell install (without sudo):

  1. pub global activate dshell
  2. Add dshell bin directory to your .bashrc/.zshrc:
export PATH="$PATH":"$HOME/.dshell/bin"
  1. You can now run dshell commands and scripts without an issue
bsutton commented 4 years ago

Dshell should add itself to the path when running the install. The doco I found on a Mac was to add a file into /etc/path.d.

It's this not the case?

bsutton commented 5 months ago

closing as no response.