Dartweb Webstorm, 502 Bad Gateway

359 Views Asked by At

While running the Get Started guide for Dart and using WebStorm as per the docs, Dartium window shows "502 Bad Gateway" when trying to run index.html for the first time.

When inspecting the IDE, the Pub Serve console shows an error while trying to run % .../pub serve web --port=<port>:

No pubspec.lock file found, please run "pub get" first

I went into my get_started project folder on the terminal and ran the same pub serve command and got the same error.

I am running WebStorm 2016.3.2 and Dart sdk 1.21.0 on Linux x64.

What is the proper procedure to follow here?

1

There are 1 best solutions below

0
Timothy C. Quinn On

WebStorm IDE has been known to have this bug where it fails to run pub get on a project which will cause failures when trying to run the project.

To verify if this is occurring, go into the IDE and check for a Pub Serve warnings message at the bottom of the window. If you see the errors outlined in the OP, then this solution should work.

The problem without running pub get is that the project dependencies have not been resolved and thus the server cannot start.

In the IDE, check the project root for a file pubspec.yaml. Right click the file and select Pub: Get Dependencies. Check the Messages window to follow for the progress. If it finishes ok, the problem should be corrected.

Alternatively, you could run pub get manually from command line as you would do without an IDE.

[Update] The Dart team has updated the documentation to guide users on this issue: https://kw-webdev-dartlang-1.firebaseapp.com/guides/get-started (Pull request #329)