AngularDart - pub build "Uncaught SyntaxError: Unexpected token )" - upload

I built my angulardart app using pub build, and uploaded the files to my server.
So the page is blank and the only error I get from the console is the following:
main.dart.js:10238 Uncaught SyntaxError: Unexpected token )
the chrome debugger points me to the following line in the main.dart.js file:
else (function(b){H.n0(F.mS(),b)})([])})})()
I triple checked my code and on my machine the build works fine. Any fixes?
Thanks in advance

dart2js should never produce syntactically invalid JavaScript. If you can share your source code or create a small example program that has the problem, please file an issue: https://github.com/dart-lang/sdk/issues/new

Related

Failed to load packages - Dart Angular Tutorial

I tried to follow the tutorial of Angular with Dart.
Everything worked fine until I got to the navigation chapter.
When I run the project with webstorm and chromium I always get this error.
I also tried to run the solution repo but I get the same error.
It seems like these packages browser / angular etc. are not loaded.
Perhaps there are some restrictions by webstorm?! The funny thing is it worked occasionally on the first run but when I refreshed the page in the browser the error always comes back.
http://localhost:63342/toh-5-master/web/packages/browser/dart.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:63342/toh-5-master/web/packages/angular/angular.dart Failed to load resource: the server responded with a status of 404 (Not Found)
package:angular/angular.dart:1 An error occurred loading file: package:angular/angular.dart
http://localhost:63342/toh-5-master/web/packages/angular_router/angular_router.dart Failed to load resource: the server responded with a status of 404 (Not Found)
package:angular_router/angular_router.dart:1 An error occurred loading file: package:angular_router/angular_router.dart
http://localhost:63342/toh-5-master/web/packages/angular_tour_of_heroes/app_component.dart Failed to load resource: the server responded with a status of 404 (Not Found)
package:angular_tour_of_heroes/app_component.dart:1 An error occurred loading file: package:angular_tour_of_heroes/app_component.dart
EDIT
The things above are working now because I changed to this repo:
github.com/angular-examples/toh-5/tree/5-dev which works with Dart 2.
Right now I have another problem with the new 5-dev repo.
Here is my console of pub serve. It says the main.template.dart is missing.
(I'm using the Dart version 2.0.0-dev.44.0.)
Does anyone how to fix this problem??
Compiling angular_tour_of_heroes|web/main.dart...
[web] GET styles.css => (cached) angular_tour_of_heroes|web/styles.css
[Error from Dart2JS on angular_tour_of_heroes|web/main.dart]:
file:///C:/xampp/htdocs/flutterprojects/toh-5-5-dev/web/main.template.dart: Could not find asset angular_tour_of_heroes|web/main.template.dart.
[Info from Dart2JS]:
Took 0:00:03.911463 to compile angular_tour_of_heroes|web/main.dart.
Build completed with 1 errors.
[web] GET main.dart.js => Could not find asset angular_tour_of_heroes|web/main.dart.js.
[web] GET index.html => angular_tour_of_heroes|web/index.html
When I run it directly with the console I get the following error.
> pub serve --web-compiler=dartdevc
Build completed successfully
[web] GET => angular_tour_of_heroes|web/index.html
[web] GET styles.css => angular_tour_of_heroes|web/styles.css
Unable to find module for angular|lib/src/bootstrap/modules.template.dart
Unable to find module for angular|lib/src/bootstrap/modules.template.dart
Unable to find module for angular|lib/src/bootstrap/modules.template.dart
For Angular 4 example apps
Load failures like this can happen if you have an error in your app that is preventing dart2js from compiling it successfully. Are any errors or warnings being reported by pub in WebStorm's Pub Serve tab? Also make sure that you are using version 1.24.3 of the Dart SDK.
I'm unable to reproduce the problem you mention. I've downloaded the project zip, and it runs fine from both the command line and WebStorm (even after making some edits and refreshing). Note that the first time you load the app, you might get a 404 because pub might not have finished compiling your app yet.
For Angular 5 example apps
As you've found out, if you'd like to try out an example using Angular 5-alpha, switch to the 5-dev branch of the repo. Ensure that you are using at least a Dart 2-dev version of the SDK.
The Dart 2 SDK no longer has support for pub build and pub serve. As of 2018Q2 you cannot use WebStorm to build and serve Angular 5 apps. Instead, you'll need to do that from the command line:
pub run build_runner serve
Then open localhost:8080 in Chrome.
For the full details see the Angular 5 Setup for Development.
Angular 5 is nearly out. I can imagine that the TOH hasn't quite caught up. You can look at https://github.com/dart-lang/site-webdev.git to see the known issues.

IBMWebsphere gives SRVE0190E: File not found ERROR

I am using docker to deploy and run my application. Everything is fine during deployment and running my application.I am using dockerDeploy and restartWas commends in order to deploy and run my application.
After I run my application , my login and password comes to my screen. Everything is fine at that step as well but after I write my login and password, I come across with the error below. I did not change anything in the code but after I restart docker I come across with the following error.
I restarted docker and also computer several times but I still come across with that. I would be glad if you can help me.
Regards
Error Page Exception
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.
Original Exception:
Error Message: SRVE0190E: File not found: {0}
Error Code: 404
Target Servlet:
Error Stack:
com.ibm.ws.webcontainer.webapp.WebAppErrorReport: SRVE0190E: File not found: {0}

Dart Analyzer in a Rail Project is Giving an Error on a Template File

I'm trying to set up the dart-rails gem. When I created my first dart code file, I got this error:
ERROR: Target of URI does not exist: 'package:rails_ujs/rails_ujs.dart' ([dart_app] dart_app.dart:1)
When I double click on the error, it brings up the following file.
app/vendor/bundle/gems/dart-rails-0.4.3/lib/dart/rails/generators/templates/dart/dart_app.dart
This is the contents of the file:
import 'package:rails_ujs/rails_ujs.dart';
RailsUjs ujsHelper;
void main() {
ujsHelper = new RailsUjs();
}
I have this same file in my app/assets/dart directory as well as the package itself. That file is not showing an error. If I change the code to something invalid, an error pops up. This proves the analyzer is looking at it as well.
The error pops up when I run Reanalyze all Dart source files (without restarting Dart Analysis Service). This is a button in the RubyMine IDE. I tried restarting the service and reanalyzing. I get the same error. This issue seems to be that the analyzer is scanning the entire project for dart files. Is it possible to control where the analyzer looks? It's RubyMine that is running the analyzer, not me at a terminal prompt.
This turned out to be a RubyMine issue. I fixed it by placing a file called .analysis_options in the root of the project with the following contents:
analyzer:
exclude:
- 'vendor/**'
I just excluded everything in the vendor directory. Even when I was getting the error, the analyzer continued to process all the valid code files.
If you import the file using
import 'package:rails_ujs/rails_ujs.dart';
the file rails_ujs.dart has to be in thelibsub-directory of the directory where thepubspec.yaml` file is
he pubspec.yaml file needs a name: rails_ujs property.
pub get needs to be run from the directory that contains the pubspec.yaml file

ant fresh_install build failed

I'm installing Dspace in Windows 7 and I got it working fine with me until I got this error message:
I tried doing what the link :build failed .. creation was not successful for an unknown reason has said, but still nothing's change. Does anyone know how to fix it?
Check dspace.install.dir at build.properties, it seems to have a bad value.
Change the value to the location you want to install and use "/" character to the directory. For example C:/Program Files/Dspace.

How can I get more information about a py2app error?

I am trying to package up a mixed Python/C++ application using py2app. My setup.py is
from setuptools import setup
setup(app=['voxpopuli.py'],data_files=[],options=
{'py2app'{'argv_emulation':True}},setup_requires=['py2app'])
and I invoke py2app via
python setup.py py2app --no-strip --iconfile /Users/irving/otherlab/other/bin/OLicon.icns --resources /opt/local/lib/Resources/qt_menu.nib
This completes without warnings or errors, but when I try to run the resuling app a window pops up that simply says "voxpopuli Error". It has an "Open Console" button, but the only console messages are
9/21/12 11:43:14.691 AM voxpopuli[52765]: voxpopuli Error
9/21/12 11:43:15.926 AM com.apple.launchd.peruser.501[158]: ([0x0-0x177d77c].org.pythonmac.unspecified.voxpopuli[52765]) Exited with code: 255
Are there standard ways to get more information out of py2app to help diagnosing this error?
I believe this is a problem with the app rather than the py2app.
If the app hits an unhandled exception it will exit out like this. Which version of osx are you using? In 10.8 they stopped automatically forwarding stderr to the console, so might be an idea to pipe the applications stdout and stderr to a file to see if you have a stack trace.
Although if it's an error in the C++ part I'm guessing you wouldn't see a stack trace, but the error could be in that part of the application.
If you really can't find the issue, try stripping large parts out the app until it runs then add bits back in until it doesn't run, then strip etc. (like a binary search) to try and find the offending part.
With the package built you can still run the 'application' from the command line.
For example for your project in ~/Projects/MyApp built into folder ~/Projects/MyApp/dist you should find you can run the following from commandline: ~/Projects/MyApp/dist/MyApp.app/Contents/MacOS/MyApp
This will output all the normal stderr messages to the console so you can see what is going wrong.

Resources