Tell us what’s happening:
Describe your issue in detail here.
Regarding the Set Up Environment challenge, I’m getting issues with the use of the socket.io library.
If I strictly follow the steps mentioned in the challenge, I get the following when running the app:
"Looks like this page is being rendered from Pug into HTML! ReferenceError: io is not defined
Unable to login"
I don’t know where the problem exactly comes from.
If I hover on “scoket.io” in this line
const io = require("socket.io")(http);
I can see the following message.
Could not find a declaration file for module 'socket.io'. '/home/runner/boilerplate-advancednode/node_modules/socket.io/lib/index.js' implicitly has an 'any' type.
Try `npm install @types/socket.io` if it exists or add a new declaration (.d.ts) file containing `declare module 'socket.io';`
After looking at this SO discussion, I replaced "socket.io": "~2.3.0"
in the package.json file with "@types/socket.io": "~2.3.0"
.
However even after this change I got the same error ReferenceError: io is not defined
.
In public/client.js, as requested in the challenge description I put
/* global io */
let socket = io();
My code is here: boilerplate-advancednode - Replit
Any help would be appreciated. I can’t complete the next challenges before fixing this issue.
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Challenge: Set up the Environment
Link to the challenge: