Welcome to the Linux Foundation Forum!

Chapter 9. Pkg Application - Nodejs Result App issue. Won't start. Outdated Nodejs.

Hello, I am having trouble making a docker image for Nodejs result app.

For starters, Nodejs 8.16 is not officially supported.

For this reason,** npm test **fails.

I used Node12 and made an image and npm test succeeds now.

However, npm start /app fails with the error below.

Can someone help me, please? Is it a code vs. Nodejs version problem?

Thanks - Nick

/app # npm start /app

result@1.1.0 start /app
node server.js "/app"

/app/server.js:12
io.set('transports', ['polling']);
^

TypeError: io.set is not a function
at Object. (/app/server.js:12:4)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
at internal/main/run_main_module.js:17:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! result@1.1.0 start: node server.js "/app"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the result@1.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-01-12T05_52_33_929Z-debug.log
/app #

Comments

  • Hi,

    I had the same issue and solved it by using the same version of node JS as in the course: node:8.9.0

    node:8.9.0

  • Hi @fredlev , thanks for confirming the fix!

    Regards,
    Luis.

  • gouravshah
    gouravshah Posts: 139

    Even though its outdated, you should be using node:8.9.0 as @fredlev suggested above. This is what is compatible with the code in the repo.

Categories

Upcoming Training