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

aqueduct create crashes with "Uncaught Error: Bad State " #837

Open InterFelix opened 4 years ago

InterFelix commented 4 years ago

I can't get aqueduct create to work. The error message is as follows:

$ aqueduct create scoutventory_backend
-- Aqueduct CLI Version: 3.3.0+1
*** Uncaught error       
    Bad state: No element
  **** Stacktrace
  * #0      ListMixin.firstWhere (dart:collection/list.dart:150:5)
  * #1      CLIAqueductGlobal.aqueductPackageRef (package:aqueduct/src/cli/commands/create.dart:342:10)
  * #2      CLIAqueductGlobal.templateDirectory (package:aqueduct/src/cli/commands/create.dart:347:12)
  * #3      CLIAqueductGlobal.getTemplateLocation (package:aqueduct/src/cli/commands/create.dart:351:12)
  * #4      CLITemplateCreator.handle (package:aqueduct/src/cli/commands/create.dart:51:27)
  * #5      CLICommand.process (package:aqueduct/src/cli/command.dart:159:20)
  * <asynchronous suspension>
  * #6      CLICommand.process (package:aqueduct/src/cli/command.dart:135:12)
  * #7      main (file:///C:/Users/myuser/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/aqueduct-3.3.0+1/bin/aqueduct.dart:9:27)
  * #8      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
  * #9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
  ****

This happens regardless of the project name I enter. Also, a folder for the project is created. However it remains empty and the program crashes.

JillyTaboga commented 4 years ago

Same Herer with the same version, using Windows 10, the same if try to create inside VSCode Extension.

joeconwaystk commented 4 years ago

What is your PUB_CACHE environment variable?

InterFelix commented 4 years ago

I don't have it set. I'm on windows. So default path would be %APPDATA%\Pub\Cache

jhigdon commented 4 years ago

experiencing same thing, also on windows 10

bettdouglas commented 4 years ago

I'm also experiencing the same issue.

-- Aqueduct CLI Version: 3.3.0+1
*** Uncaught error
    Bad state: No element
  **** Stacktrace
  * #0      ListMixin.firstWhere (dart:collection/list.dart:150:5)
  * #1      CLIAqueductGlobal.aqueductPackageRef (package:aqueduct/src/cli/commands/create.dart:342:10)
  * #2      CLIAqueductGlobal.templateDirectory (package:aqueduct/src/cli/commands/create.dart:347:12)
  * #3      CLITemplateList.handle (package:aqueduct/src/cli/commands/create.dart:298:53)
  * #4      CLICommand.process (package:aqueduct/src/cli/command.dart:159:20)
  * <asynchronous suspension>
  * #5      CLICommand.process (package:aqueduct/src/cli/command.dart:135:12)
  * #6      CLICommand.process (package:aqueduct/src/cli/command.dart:135:12)
  * #7      main (file:///C:/Users/bett/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/aqueduct-3.3.0+1/bin/aqueduct.dart:9:27)
  * #8      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
  * #9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
  ****
elhe26 commented 4 years ago

Same thing, also on windows 10

kamaribedwarddev commented 4 years ago

I am experiencing the same issue on windows 10

kamaribedwarddev commented 4 years ago

I am experiencing the same issue on windows 10

Hi All, I added the following ENVIRONMENT VARIABLES and added an entry to the PATH variable, then reinstalled Aqueduct and it suddenly started working. Not sure what happened.

NEW VARIABLES image

PATH VARIABLE ENTRIES: image

justsasri commented 4 years ago

Any idea? same issue here .. :)

OmarBakry-eg commented 4 years ago

Any solve ? I face the same issue .

kamaribedwarddev commented 4 years ago

Any idea? same issue here .. :)

Have you tried what i did?

OmarBakry-eg commented 4 years ago

@kamaribedwarddev this solution did not work for me .

OmarBakry-eg commented 4 years ago

The Solution as @kamaribedwarddev said but it works for me when I changed PUB_HOSTED_URL to https://pub.dev .

Thank You @kamaribedwarddev !

ghost commented 4 years ago

Thank you for your comments and suggestions @kamaribedwarddev @OmarBakry-eg you helped me a lot.

bahadurvaibhav commented 4 years ago

The Solution as @kamaribedwarddev said but it works for me when I changed PUB_HOSTED_URL to https://pub.dev . Thanks @OmarBakry-eg

For Flutter people, set PUB_CACHE to "Flutter_Directory\.pub-cache". In my computer it is C:\flutter\.pub-cache

Logout from your account so that environment variables get updated. After that activate aqueduct again pub global activate aqueduct For Flutter folks: flutter pub global activate aqueduct

OmarBakry-eg commented 4 years ago

You are all welcome ! @bahadurvaibhav , @javierxnora

vjpelissari commented 4 years ago

I am experiencing the same issue on windows 10

Hi All, I added the following ENVIRONMENT VARIABLES and added an entry to the PATH variable, then reinstalled Aqueduct and it suddenly started working. Not sure what happened.

NEW VARIABLES image

PATH VARIABLE ENTRIES: image

worked for me! thank you so much!

TechPertz commented 4 years ago

I'm also experiencing the same issue.

-- Aqueduct CLI Version: 3.3.0+1
*** Uncaught error
    Bad state: No element
  **** Stacktrace
  * #0      ListMixin.firstWhere (dart:collection/list.dart:150:5)
  * #1      CLIAqueductGlobal.aqueductPackageRef (package:aqueduct/src/cli/commands/create.dart:342:10)
  * #2      CLIAqueductGlobal.templateDirectory (package:aqueduct/src/cli/commands/create.dart:347:12)
  * #3      CLITemplateList.handle (package:aqueduct/src/cli/commands/create.dart:298:53)
  * #4      CLICommand.process (package:aqueduct/src/cli/command.dart:159:20)
  * <asynchronous suspension>
  * #5      CLICommand.process (package:aqueduct/src/cli/command.dart:135:12)
  * #6      CLICommand.process (package:aqueduct/src/cli/command.dart:135:12)
  * #7      main (file:///C:/Users/bett/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/aqueduct-3.3.0+1/bin/aqueduct.dart:9:27)
  * #8      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
  * #9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
  ****

I too couldn't solve the issue by implementing the above-quoted solutions.. can anybody help?

LovingLightForever commented 4 years ago

Make sure you are in a writable directory. The default cmd path on win 10 is "C:\WINDOWS\system32>" Changing directory worked for me (with the above solution)

JefTavares commented 4 years ago

I am experiencing the same issue on windows 10

Hi All, I added the following ENVIRONMENT VARIABLES and added an entry to the PATH variable, then reinstalled Aqueduct and it suddenly started working. Not sure what happened.

NEW VARIABLES image

PATH VARIABLE ENTRIES: image

worked for me! thank you so much!

yhhCh405-CS commented 4 years ago

The error still occuring even after tried with above ways

TechPertz commented 4 years ago

@yhhCh405-CS yea, i guess they have stopped the support only.. or maybe the community is really small. Anyways, i started using django(node too) for backend... Firebase is pretty powerful too along with firebase cloud functions... Just lemme know if anybody can find the Solution.

romulopuk commented 4 years ago

I am experiencing the same issue on windows 10

Hi All, I added the following ENVIRONMENT VARIABLES and added an entry to the PATH variable, then reinstalled Aqueduct and it suddenly started working. Not sure what happened. NEW VARIABLES image PATH VARIABLE ENTRIES: image

worked for me! thank you so much!

Worked for me aswell, thank you!!!

IMPORTANT STEP, REINSTALL AQUEDUCT AFTER THE ENTRIES

The first time i tried, i didn't see that.

jefflindholm commented 4 years ago

Followed those instructions with the environment and pub_cache still get the error.

Amitpatil215 commented 4 years ago

The Solution as @kamaribedwarddev said but it works for me when I changed PUB_HOSTED_URL to https://pub.dev . Thanks @OmarBakry-eg

For Flutter people, set PUB_CACHE to "Flutter_Directory.pub-cache". In my computer it is C:\flutter.pub-cache

Logout from your account so that environment variables get updated. After that activate aqueduct again pub global activate aqueduct For Flutter folks: flutter pub global activate aqueduct

This worked for me, Thank You!

Adnantjexx commented 3 years ago

i have no pub_cache folder inside pub_dartlang.org folder any help plz

TJMusiitwa commented 3 years ago

Does anyone have a solution for this same error but on the Mac system?

ghost commented 3 years ago

Does anyone have a solution for this same error but on the Mac system?

I have the as problem. I using a Mac and I have DART and FLUTTER installed! Any solution for Mac users?

jayjah commented 3 years ago

" By default, this directory is located under .pub-cache in your home directory (on Mac and Linux), or in %LOCALAPPDATA%\Pub\Cache (on Windows). " - Dart Dev Tools

hilobekerfulaisien commented 3 years ago

11/21/2020 , Same thing, also on windows 10.

gunner880101 commented 3 years ago

https://halcyonit.co.uk/bad-state-no-element-error-when-creating-aqueduct-project/

This worked for me!

andresruizdev commented 3 years ago

I am experiencing the same issue on windows 10

Hi All, I added the following ENVIRONMENT VARIABLES and added an entry to the PATH variable, then reinstalled Aqueduct and it suddenly started working. Not sure what happened.

NEW VARIABLES image

PATH VARIABLE ENTRIES: image

This Works for me

mhito commented 3 years ago

I am experiencing the same issue on windows 10

Hi All, I added the following ENVIRONMENT VARIABLES and added an entry to the PATH variable, then reinstalled Aqueduct and it suddenly started working. Not sure what happened.

NEW VARIABLES image

PATH VARIABLE ENTRIES: image

I executed this: export PUB_CACHE="/.pub-cache" on my linux and its works.