Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied on running globally activated dart package. #48675

Open
Yousuf-M-Hammad opened this issue Mar 26, 2022 · 1 comment
Open

Permission denied on running globally activated dart package. #48675

Yousuf-M-Hammad opened this issue Mar 26, 2022 · 1 comment
Labels
area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool.

Comments

@Yousuf-M-Hammad
Copy link

I'm trying to develop a command line package so I followed these steps:

dart create --template=package-simple package_name
or
dart create -t console-full package_name
(Both ends with the same results)
then activating the package globally with:

dart pub global activate --source path $(pwd)

note that I didn't find anything in the documentation about --source path actual_path but whenever I use the command only with --source actual_path I get the following:

"/Users/user/Desktop/Workspace/package_name" is not an allowed value for option "source".

So after successfully activating the package I tried to run it using:

package_name

But I got this:

zsh: command not found: package_name

Found out that the documentation here is outdated and after searching the local directory I found the actual directory is global_packages not bin, and so I've changed it.

Now when I try package_name I get:
zsh: permission denied: package_name

After investigation I found that package_name is a directory in the global_packages directory and it only contains pubspec.lock so I've tried chmod a+x on the file and the directory with no avail.

Further investigation the global_packages contained another package intl_utils inside I found:

.packages       incremental
.dart_tool      bin             pubspec.lock

But running intl_utils on the terminal too get's me the same error:
zsh: permission denied: intl_utils
I didn't install the package manually but the VS Code extension Flutter Intl did and it seems to work perfectly fine.

Now I have two questions:

  1. permission denied on what exactly since the Flutter Intl extension works perfectly???
  2. I have a file in my package bin/my_package.dart but it didn't go there, am I doing something wrong?

I'm running dart through flutter:
Flutter (Channel master, 2.13.0-0.0.pre.90, on macOS 12.3 21E230 darwin-x64, locale en-US)

dart --version

Dart SDK version: 2.17.0-202.0.dev (dev) (Thu Mar 10 20:55:41 2022 -0800) on "macos_x64"

OS: MacOs Monterey 12.3 (21E230)

@lrhn lrhn added the area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool. label Mar 27, 2022
@Yousuf-M-Hammad
Copy link
Author

So after messing around and changing the branch (a lot) turns out the problem is in the pubspec.yaml where there should be :

executables:
  package_name: # you can add a custom path here if you want though 

And i guess the docs were right about "bin" directory but it left me wondering about global_packages and intl_utils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool.
Projects
None yet
Development

No branches or pull requests

2 participants