apiconnect-docker icon indicating copy to clipboard operation
apiconnect-docker copied to clipboard

error in step 5

Open AjayKumaraj opened this issue 6 years ago • 6 comments

/usr/local/lib/node_modules/npm/bin/npm-cli.js:79 let notifier = require('update-notifier')({pkg}) ^^^

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 Function.Module.runMain (module.js:441:10) at startup (node.js:140:18) at node.js:1043:3 ERROR: Service 'microservice' failed to build: The command '/bin/sh -c npm install --silent -g npm && npm install --silent --prod && npm prune --prod' returned a non-zero code: 1

AjayKumaraj avatar May 24 '18 13:05 AjayKumaraj

I've fixed this one by updating microservice/Dockerfile from node:4-slim to node:6-slim.

I can't confirm that there are no issues in the microservice container, though, but docker-compose up -d completed and I can see gateway, portal, etc.

Thanks, Gleidson

slaterx avatar May 24 '18 23:05 slaterx

Hi Slaterx,

I changed the dockerfile as you suggested. It downloaded the image node6-slim. However, I am now seeing the below error when it it executing Step 5 -

Error: Cannot find module 'isarray' at Function.Module._resolveFilename (module.js:476:15) at Function.Module._load (module.js:424:25) at Module.require (module.js:504:17) at require (internal/module.js:20:19) at Object. (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:32:15) at Module._compile (module.js:577:32) at Object.Module._extensions..js (module.js:586:10) at Module.load (module.js:494:32) at tryModuleLoad (module.js:453:12) at Function.Module._load (module.js:445:3) ERROR: Service 'microservice' failed to build: The command '/bin/sh -c npm install --silent -g npm && npm install --silent --prod && npm prune --prod' returned a non-zero code: 1

Please suggest if we have to do anything else.

Thanks, Anjana

apilabs avatar Jun 09 '18 07:06 apilabs

I have got exactly the same problem ! Any solutions ?

djans avatar Jun 10 '18 22:06 djans

Hello AjayKumaraj, did you get a solution for this one. I also tried your solution without success ; same problem. Also trie it on AWS, no sucess. Tried it on a local VM ( But this is not an option for me ), it works. Do we nedd a special version of the host OS ? I have tried RHEL and Centos 7.

djans avatar Jun 18 '18 20:06 djans

I'm having the same problem. /usr/local/lib/node_modules/npm/bin/npm-cli.js:82 let notifier = require('update-notifier')({pkg}) ^^^

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 Function.Module.runMain (module.js:441:10) at startup (node.js:140:18) at node.js:1043:3 ERROR: Service 'microservice' failed to build: The command '/bin/sh -c npm install --silent -g npm && npm install --silent --prod && npm prune --prod' returned a non-zero code: 1

When I modified microservice/Dockerfile from node:4-slim to node:6-slim per @slaterx above, I got a different error message

module.js:478 throw err; ^

Error: Cannot find module 'strip-ansi' at Function.Module._resolveFilename (module.js:476:15) at Function.Module._load (module.js:424:25) at Module.require (module.js:504:17) at require (internal/module.js:20:19) at Object. (/usr/local/lib/node_modules/npm/node_modules/wide-align/node_modules/string-width/index.js:2:17) at Module._compile (module.js:577:32) at Object.Module._extensions..js (module.js:586:10) at Module.load (module.js:494:32) at tryModuleLoad (module.js:453:12) at Function.Module._load (module.js:445:3) ERROR: Service 'microservice' failed to build: The command '/bin/sh -c npm install --silent -g npm && npm install --silent --prod && npm prune --prod' returned a non-zero code: 1

Changed it to node:5-slim threw a different error. Anyone have any idea what's going on? Anyone have a working Docker image instead?

iutomo avatar Jul 17 '18 17:07 iutomo

@Anjana-rak + @djans, I was able to complete this by changing both microservice/Dockerfile and microservice/Dockerfile from node:4-slim to node:8-slim.

o$ docker-compose -f docker-compose-microgateway.yaml ps
    Name                  Command               State         Ports        
--------------------------------------------------------------------------
esmaster       /docker-entrypoint.sh /bin ...   Up      9200/tcp, 9300/tcp 
microgateway   /bin/sh -c /usr/bin/app.sh ...   Up            
microservice   /bin/sh -c /usr/bin/app.sh ...   Up      8080/tcp                        

Not fully tested the services though

iutomo avatar Jul 17 '18 19:07 iutomo