dojo / cli-build-webpack

🚀 **DEPRECATED** Dojo 2 - cli command for building applications
http://dojo.io
Other
4 stars 19 forks source link

Problem running "build -w" inside a docker container #248

Closed lelit closed 6 years ago

lelit commented 6 years ago

I'm trying to setup a development environment installing the dojo-cli inside a Docker container, using latest node image.

Running a dojo build --watch, the service starts and webpack emits

Starting server on http://localhost:9999
ts-loader: Using typescript@2.4.2 and /home/node/app/first-app/tsconfig.json
Hash: d58ed6ec835e265f01e5
Version: webpack 2.7.0
Time: 12508ms
                          Asset       Size  Chunks                    Chunk Names
                    src/main.js     1.7 MB       0  [emitted]  [big]  src/main
                       main.css    2.03 kB       0  [emitted]         src/main
                     index.html  299 bytes          [emitted]         
                   img/logo.svg     108 kB          [emitted]         
widgets/styles/HelloWorld.m.css  341 bytes          [emitted]         
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.11 kB       0  
webpack: Compiled successfully.
webpack: Compiling...
Hash: dafb4dbf8d34997187e6
Version: webpack 2.7.0
Time: 524ms
      Asset     Size  Chunks                    Chunk Names
src/main.js   1.7 MB       0  [emitted]  [big]  src/main
   main.css  2.03 kB       0  [emitted]         src/main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  3.11 kB       0  
webpack: Compiled successfully.

but I'm not able to connect to the app from the outside host, even if docker ps tells me that it correctly exposed the port 9999.

Digging in the source, I found this line where an explicit 127.0.0.1 is passed to the listen() method, and that apparently is the cause: simply removing that second argument fixes my issue, and I can reach the app from my host browser.

Am I doing something wrong?

matt-gadd commented 6 years ago

@lelit thanks for checking that out! no it looks like we shouldn't need to explicitly specify the ip at all like you said. do you fancy raising a pr to fix? that would be awesome 👍

lelit commented 6 years ago

Ok, I will gladly do that, hopefully just after I succeed in setting up a test environment :)

lelit commented 6 years ago

I'm not fluent with the node.js stack, and trying an npm install of this repo within a docker container (I'd prefer using that instead of a local install of node.js on my home machine, if possible) fails with the following error:

node@a58c6eb37096:~/cli-build-webpack$ nodejs --version
v9.2.0

node@a58c6eb37096:~/cli-build-webpack$ npm --version
5.5.1

node@a58c6eb37096:~/cli-build-webpack$ npm install 

> cldr-data@30.0.4 install /home/node/cli-build-webpack/node_modules/cldr-data
> node install.js

Whops {} deepEqual { url: 
   [ 'https://github.com/unicode-cldr/cldr-core/archive/30.0.3.zip',
     'https://github.com/unicode-cldr/cldr-dates-mo
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@0.3.8 (node_modules/grunt-ts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@0.3.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cldr-data@30.0.4 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cldr-data@30.0.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Maybe it's due to the node.js version? Should I retry with some older one?

I could commit the one-line-change, create a PR, and see what Travis says on the matter... but I'll wait a while for a possible suggestion.

mwistrand commented 6 years ago

@lelit This is a known issue with cldr-data on Node 8. It's obnoxious, but you'll need to install cldr-data with an earlier version of Node.

matt-gadd commented 6 years ago

@lelit ha yeah, unfortunately you've hit an issue with node 8 and a downstream dependency of ours 😢 https://github.com/rxaviers/cldr-data-downloader/issues/24. I'm fairly sure we've got an issue to remove that dependency anyway, i'll have a look. but in the meantime if you drop cldr-data out of the dependencies in the package.json and install it should work, or downgrade to node 6.

mwistrand commented 6 years ago

@matt-gadd is correct. @dojo/i18n is being simplified and this will result in cldr-data being removed as a dependency of @dojo/cli-build-webpack in a future release (although cldr-data will still be a dev dependency for @dojo/i18n for the time being).

lelit commented 6 years ago

Thanks! Will retry with Node 6 then...

lelit commented 6 years ago

What should I do to sign the CLA? The referenced page just says "Please complete the following information"...

lelit commented 6 years ago

Sorry, found the missing link on the Travis summary, signed.

matt-gadd commented 6 years ago

@lelit merged, this should go into a new release shortly (perhaps tomorrow), thanks for the contribution!

matt-gadd commented 6 years ago

@lelit we just released cli-build-webpack at 0.2.2 which should contain your fix, thanks again 👍