You are using import instead of require in a CommonJS project. Either switch to require, or set 'type': 'module' in package.json to enable ES modules. Pick one module system and use it consistently.
Common Node.js Setup Errors and How to Fix Them
Why do I get 'Cannot use import statement outside a module'?
The answer
More FAQs in Common Node.js Setup Errors and How to Fix Them
Node.js is not installed or not on your PATH. Install Node.js from the official site or use a version manager like nvm, then reopen your terminal so the PATH updates.
You are requiring a module that is not installed. Run npm install to install all dependencies from package.json, or install the specific package with npm install package-name.
Another process is using the port. Kill the other process or use a different port. On Mac/Linux, use lsof -i :PORT to find the process, then kill it. On Windows, use netstat -ano | findstr :PORT.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.