microservices-demo / front-end

Front-end application for ALL the microservices
Apache License 2.0
79 stars 2.25k forks source link

docker container nodejs SyntaxError #105

Open keltik85 opened 5 years ago

keltik85 commented 5 years ago

I am running make up every container starts except the front-end.

root@myuser-ThinkPad-T480s:/home/myuser/eclipse-workspace/front-end# docker logs front-end 

> microservices-demo-front-end@0.0.1 start /usr/src/app
> node server.js

/usr/src/app/node_modules/connect-redis/node_modules/debug/src/node.js:132
    let val = process.env[key];
    ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/src/app/node_modules/connect-redis/node_modules/debug/src/index.js:9:19)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

npm ERR! Linux 4.18.0-24-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.9.1
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! microservices-demo-front-end@0.0.1 start: `node server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the microservices-demo-front-end@0.0.1 start script 'node server.js'.
npm ERR! This is most likely a problem with the microservices-demo-front-end package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs microservices-demo-front-end
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls microservices-demo-front-end
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/app/npm-debug.log
alisondy commented 5 years ago

Hi there, Just had a look into this issue

The dockerfile that is used to build the front-end container seems to be the issue This is located at /test/Dockerfile after modifying the version of the node image used to 10-alpine and adding the --unsafe-perm flag to the command used to install phantomjs-prebuilt

the container appears to build and run, and the sock shop displays correctly.

Will submit a fix soon

keltik85 commented 5 years ago

Just one afterthought: Why would I want to test with a different environment than i am actually deploying on something like Kubernetes etc.? Why isn't there a shared Dockerfile? Why do we need to replicate Dockerfiles and introduce repetitive code?