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
Cannot find package when running file in subdirectory. #16947
Comments
It seems you are running with "home/myuser/dart/playground/bin/list_equality/packages" as the package directory. It is probably chosen as the default because you haven't specified a package-root. Are you running this from the editor? Can you pass an explicit package root to the VM: Added Area-Editor, NeedsInfo labels. |
This comment was originally written by @zoechi Your are right, when I run it from command line with --packages-root it works dart --package-root=packages bin/list_equality/main.dart # works From Darteditor context menu 'run' fails |
Set owner to @keertip. |
@gzoechi, To specify package root in the editor, context menu for project in the Files View > Properties > Dart > Package Root settings. Once you set that, the launch will pick it up and it should run fine. The default is to look in the project for a packages directory. |
This comment was originally written by @zoechi @kertip I'm not convinced that this is a solution. I have the default packages directory, why should I change the configuration then. I think I just want to know if it is an out of the box supported scenario to have a script file in a subdirectory of bin. If you say only the bin directory itself is supported without special settings, it's fine too, then you can simply close this issue. I'm glad I asked anyway because I again learned a few new things. |
This comment was originally written by @zoechi Now I have this problem with a unit test. It seems the cause is that I moved the subdirectory from test/db/di to which broke the packages symlink the directory list_equality (above) has no packages symlink at all (I thought they are gone already. It was mentioned frequently that a solution without symlinks is WIP) I'm still not sure how to cope with such situations. |
The packages symlinks are created by pub and not DartEditor. It creates a packages fodler in web and test and all its subfolders, and in bin. You can run pub get to create the symlinks when you create new folders. DartEditor tries to do this automatically, but am sure there are missed cases. If you move/create directories, do run pub get. Closing this issue, reopen if necessary. Added AsDesigned label. |
This comment was originally written by @zoechi Thanks for the info. I never saw this mentioned before, that |
This comment was originally written by @zoechi I have a dart file in mypackage/bin/async/delay and |
This comment was originally written by @zoechi Seems also not to work for others in subdirectories of |
This issue was originally filed by @zoechi
What steps will reproduce the problem?
1.
I have this Dart script
mypackage/bin/list_equality/main.dart
with the content
library x;
import 'package:collection/equality.dart';
void main(List<String> args) {
if (const IterableEquality().equals([1,2,3],[1,2,3])) {
print("Equal");
} else {
print("Not equal");
}
}
2.
When I run it I get
Unable to open file: /home/myuser/dart/playground/bin/list_equality/packages/collection/equality.dart'file:///home/myuser/dart/playground/bin/list_equality/main.dart': error: line 3 pos 1: library handler failed
import 'package:collection/equality.dart';
3.
When I move main.dart one level higher (out of 'list_equality' it works.
"import 'dart:xxx'" works in this sub directory but the 'package:collection/equality.dart' doesn't.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Dart VM version: 1.2.0-dev.5.10 (Wed Feb 19 01:25:31 2014) on "linux_x64"
Please provide any additional information below.
The text was updated successfully, but these errors were encountered: