Just when I thought I was getting the hang of socket.io, I hit a roadblock on the client side. Following my instructor's advice, I installed socket.io-client package for my project. But when I tried to use it in my client-side JS code, I encountered an error. My socket.io setup is configured to run on port 3000 and this is my first attempt at incorporating npm packages into client-side JavaScript development. The tutorial video that my instructor referred me to can be found here: https://www.youtube.com/watch?v=ZKEqqIO7n-k&t=96s The specific error message I received is as follows:
Uncaught TypeError: Failed to resolve module specifier "socket.io-client". Relative references must start with either "/", "./", or "../".
Below is the snippet of code where the error occurred:
import { io } from "socket.io-client";
const socket = io("http://localhost:3000");
If anyone has experience resolving this type of issue, I would greatly appreciate your help!