Last modified: Jun 22, 2026

Fix Sequelize Module Not Found Error

Encountering the error Cannot find module 'sequelize' in Node.js is common. It often stops your app from running. This guide will help you fix it quickly.

This error means Node.js cannot locate the Sequelize package. It usually happens after cloning a project, updating dependencies, or moving code. Let's solve it step by step.

Why This Error Occurs

The error appears when the Sequelize module is missing from your node_modules folder. Common causes include:

  • You forgot to run npm install after cloning a project.
  • The package was accidentally deleted or corrupted.
  • You are using a different Node.js version that breaks compatibility.
  • The package.json file lacks Sequelize in its dependencies.

Understanding the cause helps you choose the right fix. Most beginners face this when setting up a new project.

Quick Fix: Install Sequelize

The simplest solution is to install Sequelize locally. Run this command in your project root:


npm install sequelize

This installs the module and adds it to package.json. If you need a specific version, use:


npm install [email protected]

After installation, test your app again. The error should disappear. For more help with similar issues, read our guide on Fix Node.js Error: Cannot find module.

Check Your package.json

Ensure Sequelize is listed in dependencies. Open your package.json file and look for it:


{
  "dependencies": {
    "sequelize": "^6.37.3"
  }
}

If it is missing, add it manually then run npm install. This ensures the module will be installed on future setups.

Reinstall node_modules

Sometimes the node_modules folder gets corrupted. Delete it and reinstall all packages:


# Delete node_modules and package-lock.json
rm -rf node_modules package-lock.json

# Reinstall all dependencies
npm install

This refreshes everything. It is a safe fix for many module errors.

Verify Node.js and npm Versions

Sequelize requires a recent Node.js version. Check your versions:


node --version
npm --version

Sequelize 6 works with Node.js 10 and above. If you use an older version, upgrade Node.js. Then reinstall Sequelize.

Example Code to Test

Here is a simple script to test if Sequelize is working. Create a file named test.js:


// test.js - Check if Sequelize is installed
const Sequelize = require('sequelize');

// Initialize a connection (no database needed for test)
const sequelize = new Sequelize('sqlite::memory:');

// Test the connection
sequelize.authenticate()
  .then(() => {
    console.log('Sequelize is working!');
  })
  .catch(err => {
    console.error('Connection failed:', err);
  });

Run the script:


node test.js

Expected output:


Sequelize is working!

If you see this, the module is fixed. If not, review the steps above.

Check for Global Installation

Do not install Sequelize globally. It must be local to your project. To check, run:


npm list -g sequelize

If it shows globally, remove it and install locally:


npm uninstall -g sequelize
npm install sequelize

Global modules can cause path conflicts. Always use local installations.

Check Module Path

Node.js looks for modules in node_modules of your project. If you moved files, the path might be wrong. Ensure your script is in the same directory as node_modules.

If you use a monorepo, install Sequelize in the correct subfolder. Run npm install sequelize from the folder containing your package.json.

Clear npm Cache

A corrupted cache can cause install failures. Clear it and reinstall:


npm cache clean --force
npm install sequelize

This often fixes stubborn errors. It is a good step before trying more advanced solutions.

Use a Package Lock File

If you have a package-lock.json, it locks versions. Delete it and regenerate:


rm package-lock.json
npm install

This creates a fresh lock file. It helps if the old one had conflicts.

Prevent Future Errors

To avoid this error in the future, always run npm install after cloning a project. Use version control for your package.json and package-lock.json. This ensures everyone uses the same dependencies.

Also, add node_modules to your .gitignore file. This keeps your repository clean and avoids accidental deletions.

Conclusion

The Cannot find module 'sequelize' error is easy to fix. Start by installing the module with npm install sequelize. If the problem persists, reinstall node_modules, check your Node.js version, or clear the npm cache. Always install Sequelize locally in your project.

For more help with module errors, check our guide on Fix Node.js Error: Cannot find module. With these steps, your Node.js app will run smoothly again.