How to resolve Error: Cannot find module 'C: wamp64 www sqlnode index.js'

Asked

Viewed 645 times

-1

When I try to run my server in Ode, this error message is displayed, I checked the models and paths of the files I am including and apparently everything is right. So is my index.js file:

const Sequelize = require('sequelize');
const dbConfig = require('../config/database');
const User = require('../models/User');

const connection = new Sequelize(dbConfig);

User.init(connection); //essa connection ocupa o parametro sequelize, assim conectando o User com a base de dados

module.exports = connection;    

The complete error displayed is

Error: Cannot find module 'C:\wamp64\www\sqlnode\index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)     
    at Function.Module._load (internal/modules/cjs/loader.js:855:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Someone can help me?

1 answer

0

Are you importing the sequelize, but you installed this package? If not, you have to install the package sequelize through npm within your project. Ex:

$npm i sequelize

More hints: https://www.npmjs.com/package/sequelize

Browser other questions tagged

You are not signed in. Login or sign up in order to post.