Chromium and Dart: "An error occurred loading file" - apache

I'm trying to run some Dart templates from Stagehand. The 'ubersimplewebapp' app works. There's almost nothing to it. I've tried a couple of others and they don't. I'm currently trying to get 'webapp' to work. In install using PHPStorm and there are no errors. When I run it in the Chromium browser, I get the following console errors:
GET http://dartorium.loc/packages/browser/dart.js
GET http://dartorium.loc/packages/dartorium/nav_menu.dart
An error occurred loading file: package:dartorium/nav_menu.dart
GET http://dartorium.loc/packages/route_hierarchical/client.dart
An error occurred loading file: package:route_hierarchical/client.dart
GET http://dartorium.loc/packages/dartorium/reverser.dart
An error occurred loading file: package:dartorium/reverser.dart
This is the pubspec.yaml file:
name: 'dartorium'
version: 0.0.1
description: >
A minimal web app for the developer that doesn’t want to be confused by too
much going on.
#author: <your name> <email#example.com>
#homepage: https://www.example.com
environment:
sdk: '>=1.0.0 <2.0.0'
dependencies:
browser: any
sass: '>=0.4.0 <0.5.0'
script_inliner: '>=1.0.0 <2.0.0'
route_hierarchical: '>=0.5.0 <0.7.0'
transformers:
- script_inliner
#- sass:
# style: compressed
This is the log from installing the template the PHPStorm produced:
Working dir: /Volumes/Data/htdocs/dartorium
/usr/local/opt/dart/libexec/bin/pub get
Resolving dependencies...
+ analyzer 0.22.4 (0.24.0 available)
+ args 0.12.2+6
+ barback 0.15.2+4
+ browser 0.10.0+2
+ cli_util 0.0.1+1
+ code_transformers 0.2.5
+ collection 1.1.0
+ csslib 0.11.0+4
+ html5lib 0.12.0
+ logging 0.9.3
+ path 1.3.3
+ pool 1.0.1
+ route_hierarchical 0.6.1+1
+ sass 0.4.2
+ script_inliner 1.0.0
+ source_maps 0.10.0+1
+ source_span 1.0.3
+ stack_trace 1.2.1
+ utf 0.9.0+2
+ watcher 0.9.4
+ when 0.2.0
+ which 0.1.3
Changed 22 dependencies!
Precompiling dependencies...
Loading source assets...
Loading script_inliner transformers...
Precompiled script_inliner.
Process finished with exit code 0
A directory snapshot
My vhosts entry just in case:
<VirtualHost *:80>
ServerName dartorium.loc
DocumentRoot "/Volumes/Data/htdocs/dartorium/web"
<directory /Volumes/Data/htdocs/dartorium>
Allow from all
Options -MultiViews
Require all granted
</directory>
</VirtualHost>
Update
I decided to try creating the app outside of PHPStorm. I deleted the app and did 'stagehand webapp' in Terminal to install it again and then 'pub get'. I still got the same errors.
I then noticed a comment in the output that said to do 'pub serve' and then connect to the site on localhost:8080. When I did that, the app ran fine. So now my question is how do you run the app using Apache?
Answer
The accepted answer below given by Günter Zöchbauer solved the problem. In addition to what is described there, I made two other changes. After any change in the code, I run 'pub build'. I'm spoiled by working in PHP and RoR using RubyMine where all I have to do is refresh the browser. The other change was to my vhosts entry. It's now set to:
<VirtualHost *:80>
ServerName dartorium.loc
DocumentRoot "/Volumes/Data/htdocs/dartorium/build/web"
</VirtualHost>
I had originally added the permissions to fix some access problems I had before starting this post. It turns out they weren't necessary. The entry now points to build/web instead of the web directory in which you work.

You need to run pub build to generate JavaScript output (in build/web). This build output can be served by apache.
The build output works fine in Chrome without change. To make it work in Dartium I changed the script tags:
<script src="main.dart.js"></script>
<!--<script type="application/dart" src="main.dart"></script> -->
<!--<script data-pub-inline src="packages/browser/dart.js"></script>-->

Related

Missing config.json stencil CLI

I'm trying to do some work for a client, but cannot get their bigcommerce site running locally. I have installed stencil CLI (v3.1.1) and downloaded the theme from the bigcommerce dashboard (all files). from the root of the theme i ran "stencil init", then "npm i" and "stencil start".
when i run stencil start, it throws an error saying there's no config.json file.
this is the error i get
How do i generate the config.json file?
The only config file I see is config.stencil.json.
I have also tried running "stencil pull" in hopes that it would pull the config, but it throws another error: "not ok -- Error: Could not fetch active theme details for channel 1: Request failed with status code 404"
Stencil-cli version:
3.1.1
Node version:
12
NPM version:
6.14.15
OS:
mac big sur
Stencil 3.1.1 has been deprecated for some time now. I believe the current version is 3.8. As of 4 months ago, anything below 3.5 will not run (https://developer.bigcommerce.com/changelog#publications/required-stencil-cli-version-set-to-3-5-0).
If you don't have a config.json file in your project, you will need to get the one from the client's store. Try downloading their theme again. It should come through.
Edit: It is possibly the case that you need a new API token. Try making a new one for your store. Make sure the following scopes are set:
Themes: Modify
Settings & Information: Modify
Sites & Routes: Read-only (or Modify)
Documentation for creating a new API account: https://support.bigcommerce.com/s/article/Store-API-Accounts#creating

Why is my ProxyPass and uWSGI not connecting?

I am trying to get a python environment live for a Django project and it's fighting me. I have installed mod_proxy_uwsgi through EasyApache4 (mod_proxy was already on). I have added the following include in the Apache include editor under pre-virtual host (Versioned):
include /etc/apache2/conf.d/userdata/std/2_4/user/domain/proxy.conf
with the following content:
ProxyPreserveHost On
ProxyPass "/" "unix://localhost/var/run/swerth_django.sock"
ProxyPassReverse "/" "unix://localhost/var/run/swerth_django.sock"
I have used YUM installer to install uWSGI and run using a .ini file (command:uwsgi --ini php.ini) with the following content which is executing fine so far (no error messages):
[uwsgi]
chdir=/home/swerth/public_html/mysite
module=mysite.wsgi:application
env=DJANGO_SETTINGS_MODULE=mysite.settings
master=True
pidfile=/tmp/project-master.pid
socket=127.0.0.1:49152
processes=5
harakiri=20
post-buffering=1
max-requests=5000
vacuum=True
home=/home/swerth/public_html/Swerth.VirtualEnv
Despite all this, it's still not working. My Django project still isn't serving. I have a sneaky suspicion that there's something I don't understand about these systems and reverse proxying. Is there something I'm missing or messing up?
Ok, so turns out I was adding my Include function under the versioned part of the includes editor and it needed to be added under the global one because of how the includes editor adds the files to the main httpd.conf file (versioned wasn't being included into the main httpd.conf for some reason)

How to produce deployment version of a Vue.js CLI site?

I have setup a Vue.js CLI project
I ran npm run dev and it runs in my browser at port 8080
I made some changes to the site
I typed npm run build.
moved the contents of the dist folder under an Apache server
but I get the error
Failed to load resource: the server responded with a status of 404(Not
Found)
What else do I need to copy here to avoid this error, or what can't it load exactly?
Ok, I figured it out:
Because I put the files in a subdirectory, I had to go into the index.html file and search and replace /static with static.
From: <link href=/static/css/app.fd50d336198a48f4f49d999710298aad.css
To: <link href=static/css/app.fd50d336198a48f4f49d999710298aad.css

Angular CLI routing - Doesn't work on (Apache-) Server

I'm currently learning Angular-CLI for a Project. I succeeded in creating a simple little project with some routing Objects. In dev mode with ng serve, everthing works just fine. I can call the localhost:port in the browser and it works with the routing.
.
After a successful ng build -prod and moving all the stuff from the dist directory into my Server Folder (Apache24/htdocs), I start my Server and the main Side (mywebside) just works fine, the routing however does not... (i.e. localhost/about), instead I get a standart Error-Page as shown below:
Hope I was able to describe clearly what I did and where my problems are. I didn't posted any Code because I think the problem has to be else where.
Thank you for your help!
Manuel
Versions:
angular CLI: Beta.8 (latest)
(apache): 2.4.20
OK figured it out (with help from PierreDuc!)
You have to do 2 things:
add a .htaccess file: (just like that no filename!) in the folder where your index.html File is saved, insert this code:
ErrorDocument 404 /index.html
Edit the httpd.conf:
(you find the File in the Apache24/conf/ directory) search for the line:
<Directory "c:/Apache24/htdocs"> [...] -> in my Version of apache it is in line 244
a few lines further (after a few comments) you should find this line:
AllowOverride none -> in my Version of apache it is in line 264
change this line to
AllowOverride ALL
Thats it, now your Angular-CLI Website should work in the production build with routing objects
hope it might be helpful to other Developpers!
Thanks to PierreDuc!
Manuel

Jasmine runner at '/specs' returned a 302 error: Found

I'm using jasmine-rails-0.4.5 and devise-2.2.3 in a standard rails-3.2 app. When I run bundle exec rake spec:javascript, in order to run the jasmine specs, I'm getting the following message: "Jasmine runner at '/specs' returned a 302 error: Found"
Since I'm using devise any request against the server that is not authenticated yet, it's being redirected to the log-in page. So far so good, that is the expected behavior from devise, but jasmine-rails need to access the /specs url in order to run the tests, so when it tries to access this it, it's getting this error: "Jasmine runner at '/specs' returned a 302 error: Found"
In my routes.rb file I added this line: "*mount JasmineRails::Engine => "/my_specs" if defined?(JasmineRails)*"
Any clue?
Thanks
This is what it fixed the issue (I did an upgrade for a newer version):
update your js libraries
get rid of all the entries under the section "src_files" except for "assets/application.js" on the spec/javascripts/support/jasmine.yml file
Add this file:
+++ b/spec/javascripts/support/jasmine_helper.rb
## -0,0 +1,13 ##
+#Use this file to set/override Jasmine configuration options
+#You can remove it if you don't need it.
+#This file is loaded *after* jasmine.yml is interpreted.
+#
+#Example: using a different boot file.
+#Jasmine.configure do |config|
+# #config.boot_dir = '/absolute/path/to/boot_dir'
+# #config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
+#end
+#
+
+Rails.application.config.action_controller.asset_host = "//localhost:8888"
+Rails.application.config.base_url = ENV['BASE_URL'] || "http://localhost:8888"
Get rid of this file: spec/javascripts/support/jasmine_runner.rb
Hope this helps