throw err;
^
Error: Cannot find module '../models/GuildCurrency'
Require stack:
- C:\Users\ouadi\Downloads\Motion Revamp\commands\prefix\Economy\setcurrency.js
- C:\Users\ouadi\Downloads\Motion Revamp\handlers\prefix.js
- C:\Users\ouadi\Downloads\Motion Revamp\index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\ouadi\Downloads\Motion Revamp\commands\prefix\Economy\setcurrency.js:2:23)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\ouadi\\Downloads\\Motion Revamp\\commands\\prefix\\Economy\\setcurrency.js',
'C:\\Users\\ouadi\\Downloads\\Motion Revamp\\handlers\\prefix.js',
'C:\\Users\\ouadi\\Downloads\\Motion Revamp\\index.js'
]
}
Node.js v19.3.0
PS C:\Users\ouadi\Downloads\Motion Revamp> ```
const GuildCurrency = require("../models/GuildCurrency");
WHat did I do wrong with the path?
#Got err trying models thingie
19 messages · Page 1 of 1 (latest)
😭
How many dots should I use
One ../ for every directory you want to go up. You are in …/commands/prefix/Economy/ and want to go to …/models/. Pretty sure you can count yourself
Alright
so
what if I want to get down
like from economy to models
I don't fully understand
Did you ever use a file explorer? Up doesn’t mean up in that list you have there… it means one level upwards to the containing directory
I'm not the brightest, are there some docs about paths I could read lol
const GuildCurrency = require('C:/Users/ouadi/Downloads/Motion Revamp/models/GuildCurrency');
This worked
Just don't know how to do this with dots
YES
I finnaly got it
const GuildCurrency = require('../../../models/GuildCurrency');
so many dots
Documentation suggestion for @worn shuttle:
Dealing with files
A website consists of many files: text content, code, stylesheets, media content, and so on. When you're building a website, you need to assemble these files into a sensible structure on your local computer, make sure they can talk to one another, and get all your content looking right before you eventually upload them to a server. Dealing with files discusses some issues you should be aware of so you can set up a sensible file structure for your website.