KRusl
KRusl
DDeno
Created by KRusl on 11/8/2023 in #help
Error with imports
I have this fancy peace of code that import a bunch of files from a directory:
const utils = {};
const utilsDirectory = Deno.realPathSync(`${Deno.cwd()}/utils`);
const utilsFiles = Deno.readDirSync(utilsDirectory);

for (const utilsFile of utilsFiles) {
const filePath = `${utilsDirectory}/${utilsFile.name}`;
import(pathToUrl(filePath)).then(util => {
Object.assign(utils, util);
});
}
const utils = {};
const utilsDirectory = Deno.realPathSync(`${Deno.cwd()}/utils`);
const utilsFiles = Deno.readDirSync(utilsDirectory);

for (const utilsFile of utilsFiles) {
const filePath = `${utilsDirectory}/${utilsFile.name}`;
import(pathToUrl(filePath)).then(util => {
Object.assign(utils, util);
});
}
Structure of utils directory is:
- utils
- getTime.ts
- pathToUrl.ts
- someOtherFuncs.ts
- utils
- getTime.ts
- pathToUrl.ts
- someOtherFuncs.ts
When run this code using deno run everything is alright. But when I'm trying to deploy my app to Deno Deploy via deployctl deploy I receive this error:
× Deployment failed.
error: The deployment failed: UNCAUGHT_EXCEPTION

Uncaught (in promise) TypeError: module not found: 'file:///utils/getTime.ts'
× Deployment failed.
error: The deployment failed: UNCAUGHT_EXCEPTION

Uncaught (in promise) TypeError: module not found: 'file:///utils/getTime.ts'
Is there are something tricky about Deno Deploy FS? I don't get it why deno can't find this file.
5 replies
DDeno
Created by KRusl on 11/7/2023 in #help
Whimsical error shows up when I run a file
I'm trying to make a discord bot with Deno and d.js but for some reasons I get this error
error: Relative import path "@discordjs/util" not prefixed with / or ./ or ../
at file:///C:/Users/andri/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/builders/1.6.5/dist/index.d.ts:4:42
error: Relative import path "@discordjs/util" not prefixed with / or ./ or ../
at file:///C:/Users/andri/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/builders/1.6.5/dist/index.d.ts:4:42
15 replies