small medium large xlarge

Generic-user-small
26 Oct 2016, 15:20
Laura (40 posts)

Hi David, decided to see what is new in second eddition. I wish I did not:) after running npm install on page 9:

npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14 npm WARN atm@0.0.1 No repository field.

So I dont get:

«ASCII-art animations of packages being checked and installed»

I googled the issue. I seems webpack and Cloud 9 have problems. Maybe I should revert to bower. Will Angular 2 work with bower?

regards

Laura

Dmfcb_pragsmall
26 Oct 2016, 16:15
David Copeland (433 posts)

Angular 2 does not work with bower. The fsevents thing is a known issue in Node where basically some stuff doesn’t work on Linux at all because while fsevents is an optional dependency, a lot of packages try to install it anyway.

https://github.com/webpack/webpack/issues/1435

outlines the problem

You can try npm install --no-optional. I have not had success with that.

Generic-user-small
27 Oct 2016, 11:23
Laura (40 posts)

thank you David. It sort of works. But I get errors:


Failed to load resource: the server responded with a status of 404 (Not Found)
rapab2-laris.c9users.io/:1 Mixed Content: The page at 'https://rapab2-laris.c9users.io/' was loaded over HTTPS, but requested an insecure script 'http://rapab2-laris.c9users.io:3808/webpack/application.js'. This request has been blocked; the content must be served over HTTPS.

Mixed Content: The page at 'https://rapab2-laris.c9users.io/' was loaded over HTTPS, but requested an insecure script 'http://rapab2-laris.c9users.io:3808/webpack/application.js'. This request has been blocked; the content must be served over HTTPS.

I cant see the point to continue with this eddition. I understand how it is difficult to write a book like this using so many dependancies.

regards

Laura

Dmfcb_pragsmall
27 Oct 2016, 13:23
David Copeland (433 posts)

It seems to be complication from using Cloud 9. Do you have access to any other development environment? I’m not familiar with it at all, so I’m afraid I can’t help right now. I do have it on my list to look into, but it’s very foreign to me as I usually develop on a local computer.

Generic-user-small
27 Oct 2016, 15:47
Laura (40 posts)

David, I will let you know if I find how to fix it. I dont have a local environment. I use Cloud 9 because I can access it from any computer. It is very convinient and powerfull. It was acqured by Amazon so it is here to last.

This may help but I could not find newconnection function in index.js…


https://github.com/webpack/webpack-dev-server/pull/470/commits/70bc37608dd91dcfde59fc398cb784e52cd8d8b7

also i dont know how to resolve these installation problems:


npm WARN webpack-dev-server@1.16.2 requires a peer of webpack@>=1.3.0 <3 but none was installed.
npm WARN webpack-dev-middleware@1.8.4 requires a peer of webpack@1 || ^2.1.0-beta but none was installed.

regards

Laura

Generic-user-small
12 Jun 2017, 15:45
Laura (40 posts)

Hi David,

I decided to try again. Have not not got far: just after adding

<%= javascript_pack_tag "application" %>
<%= stylesheet_pack_tag "application" %>

I get Mixed content error again. I use cloud9. I know that you have not tried. Just wanted you to know that the error persists. I have tried a sample app using angular-cli. No problems. It seems that webpack-dev-server has a bug that stops it from working over a firewall.

regards

Laura

Dmfcb_pragsmall
12 Jun 2017, 16:40
David Copeland (433 posts)

Yeah, Cloud 9 is known to not work well for this.

BUT! According to https://github.com/rails/webpacker/pull/431 you can change it. The discussion there might help, as they specifically reference cloud 9.

Generic-user-small
13 Jun 2017, 09:09
Laura (40 posts)

Thank you David. It is not Cl9 problem. It is webpack. Angular-cli works fine: “ng serve”, no problems. I can’t understand why you use webpack at all. You use yarn as a package manager and you use webpack to serve the app. If you use angular, could Angular-cli replace webpack? This is what I try to do now. I hoped that your last revision will work for me. I liked the concept but I will probably have to find my own way. regards. Laura

Dmfcb_pragsmall
13 Jun 2017, 11:16
David Copeland (433 posts)

Did you try doing what is recommended in that PR? I’m almost certain that is the problem. webpack-dev-server is configured to run on 0.0.0.0 which I believe Cloud 9 does not allow. You can change this in config/webpacker.yml. Did you try doing that?

Remember it’s not Webpack that serving files. In development, webpack-dev-server is serving up the files managed by webpack so that you get auto-reload.

Another thing you can try is to remove the devServer: stanza from config/webpack/development.js. This will configure Rails to not use the dev server and expect Rails to serve up your assets. Whenever you change JS or CSS, you have to run bin/webpack.

Note on angular-cli - this is not a server per se. It’s just a thing that glues together a bunch of other stuff. It produces project structures incompatible with Rails, so if you go this route, you will need to learn a lot more about Webpack and will need to make it work with Rails by hand, using a non-standard mechanism. Webpacker exists exactly to set up all the Webpack config so you don’t have to mess with it.

Generic-user-small
14 Jun 2017, 15:38
Laura (40 posts)

Hi David, Thank you very much. You really do more then you should:) I looked at webpacker.yml and changed

dev_server:
    host: $IP
    port: $PORT
    https: true

Mixed content error caused by http i guess. Now I get

GET https://0.0.0.0:8180/packs/application.css net::ERR_EMPTY_RESPONSE
rapab7-laris.c9users.io/:13 
GET https://0.0.0.0:8180/packs/application.js net::ERR_EMPTY_RESPONSE

I will continue my explorations.

regards

Laura

Dmfcb_pragsmall
14 Jun 2017, 21:59
David Copeland (433 posts)

I guess that’s progress? let me know what you find out. You aren’t the only Cloud 9 user out there…

Generic-user-small
16 Jun 2017, 08:51
Laura (40 posts)

Hi David,

Yes, it is progress… Your suggestion do not use webpack-dev-server works. But what is weird that I have to run

 bin/webpack

when I change procfile. If I have only

rails s -b $IP -p $PORT 

in procfile, why would I need foreman? thank you for all your help

kindly

laura

Dmfcb_pragsmall
15 Jun 2017, 16:19
David Copeland (433 posts)

Yeah, the workflow without the dev server would be:

  1. bin/rails server
  2. (in another window if that’s possible) bin/webpack whenever JS/CSS changes (rails should pick it up without restarting the server)

So, in that case, you don’t need foreman since you only have one thing to keep running.

You must be logged in to comment