stablekernel / aqueduct

Dart HTTP server framework for building REST APIs. Includes PostgreSQL ORM and OAuth2 provider.
https://aqueduct.io
BSD 2-Clause "Simplified" License
2.41k stars 279 forks source link

*** Uncaught error Bad state: No element #908

Open syedsohanahmed opened 3 years ago

syedsohanahmed commented 3 years ago

I am facing this issue to create a aqueduct project aqd

-- Aqueduct CLI Version: 3.3.0+1 * Uncaught error Bad state: No element ** Stacktrace

jayjah commented 3 years ago

@syedsohanahmed Which dart version do you use?

Prn-Ice commented 3 years ago

I have the same error, using Dart SDK version: 2.10.2 (stable) (Tue Oct 13 15:50:27 2020 +0200) on "linux_x64"

syedsohanahmed commented 3 years ago

@jayjah I am using Dart SDK version: 2.10.2 (stable) (Tue Oct 13 15:50:27 2020 +0200) on "windows_x64"

jayjah commented 3 years ago

Actually I am on "macosx" and aqueduct with 3.3.0+1 and pre-release version is working fine. Do you experience the same behaviour with the pre-release version?

pub global activate aqueduct 4.0.0-b1

The actual problem is the following: Aqueduct tries to get a reference of the global aqueduct package, which was installed with the above command. Obviously it can't find that one and throws an error. It seems that somehow your environment variables are misleading. The package that makes the mistake is this one: Pub_Cache and moreover this issue seems to be related to your problem as well: Pub_Cache Issue.

You could debug your global dart packages with the Pub_Cache package and I guess you'll find the problem anywhere there.

syedsohanahmed commented 3 years ago

@jayjah Thanks a lot, the problem has been solved to use the command pub global activate aqueduct 4.0.0-b1 @Prn-Ice

jayjah commented 3 years ago

@syedsohanahmed Glad to hear! Cheers up!

arcticfox1919 commented 3 years ago

pub global activate aqueduct 4.0.0-b1 seems useless

jayjah commented 3 years ago

@arcticfox1919

Please check my previous post.

The actual problem is the following: Aqueduct tries to get a reference of the global aqueduct package, which was installed with the above command. Obviously it can't find that one and throws an error. It seems that somehow your environment variables are misleading. The package that makes the mistake is this one: Pub_Cache and moreover this issue seems to be related to your problem as well: Pub_Cache Issue.

You could debug your global dart packages with the Pub_Cache package and I guess you'll find the problem anywhere there.

arcticfox1919 commented 3 years ago

@jayjah Thanks for your reply, I have solved the problem.It is indeed a problem with Pub_Cache

Need to configure a global environment variable on the windows platform:

PUB_CACHE=%LOCALAPPDATA%\Pub\Cache
mohahmhas commented 3 years ago

after writing this command
pub global activate aqueduct 4.0.0-b1 Appeared this issue 2121

MouhibAgrebi commented 3 years ago

after writing this command pub global activate aqueduct 4.0.0-b1 Appeared this issue 2121

Same any solution ?

bumpsoo commented 3 years ago

@MouhibAgrebi

Have you added PUB_CACHE to environment variables? Since I added it, It works fine.

PUB_CACHE C:\src\flutter.pub-cache (I use flutter) If you dont use flutter and installed dart sdk, check user's appdata folder. There should be pub and cache folder. ensure restart your system if you added it to user variables.

MouhibAgrebi commented 3 years ago

@MouhibAgrebi

Have you added PUB_CACHE to environment variables? Since I added it, It works fine.

PUB_CACHE C:\src\flutter.pub-cache (I use flutter) If you dont use flutter and installed dart sdk, check user's appdata folder. There should be pub and cache folder. ensure restart your system if you added it to user variables. @bumpsoo063 no, how i can add it ?

MouhibAgrebi commented 3 years ago

@MouhibAgrebi

Have you added PUB_CACHE to environment variables? Since I added it, It works fine.

PUB_CACHE C:\src\flutter.pub-cache (I use flutter) If you dont use flutter and installed dart sdk, check user's appdata folder. There should be pub and cache folder. ensure restart your system if you added it to user variables.

1

bumpsoo commented 3 years ago

@MouhibAgrebi oh sorry I misunderstood your comments. Have your activated stable aqueduct? not the one pre-release(4.0.0-b1). Was there the same error when activating? or did you get an error when creating a aqueduct project? If you had no problems with activating stable version and had a problem when creating it. The way in my comment should solve. And to set environment variables. press window in your keyboard and search environment variable. you can find details by searching.

Anyway I got the error you're getting when I was activating angel-dart. Probably Its because There is not lib/analyzer.dart in newer analyzer package.

you can reference this guy's issue solution