Error: Cannot find module 'src/schemas/index.ts'
See original GitHub issueDescribe the bug After updating from version 1.10.0 to 1.10.1 you get the following error :
`Running joi-to-typescript… (node:3844) UnhandledPromiseRejectionWarning: Error: Cannot find module ‘src/schemas/index.ts’ Require stack:
- /Users/thomaskuhlmann/Projects/app/functions/node_modules/joi-to-typescript/dist/analyseSchemaFile.js
- /Users/thomaskuhlmann/Projects/app/functions/node_modules/joi-to-typescript/dist/convertFilesInDirectory.js
- /Users/thomaskuhlmann/Projects/app/functions/node_modules/joi-to-typescript/dist/index.js
- /Users/thomaskuhlmann/Projects/app/functions/scripts/types.ts
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._resolveFilename (/Users/thomaskuhlmann/Projects/app/functions/node_modules/tsconfig-paths/lib/register.js:75:40)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.analyseSchemaFile (/Users/thomaskuhlmann/Projects/app/functions/node_modules/joi-to-typescript/dist/analyseSchemaFile.js:20:30)
at Object.convertFilesInDirectory (/Users/thomaskuhlmann/Projects/app/functions/node_modules/joi-to-typescript/dist/convertFilesInDirectory.js:57:58)
at Object.convertFromDirectory (/Users/thomaskuhlmann/Projects/app/functions/node_modules/joi-to-typescript/dist/index.js:95:62)
at types (/Users/thomaskuhlmann/Projects/app/functions/scripts/types.ts:7:24)
at Object.<anonymous> (/Users/thomaskuhlmann/Projects/app/functions/scripts/types.ts:23:1)
(node:3844) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:3844) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`
To Reproduce Run:
import { convertFromDirectory } from "joi-to-typescript";
const types = async (): Promise<void> => {
console.log("Running joi-to-typescript...");
// Configure your settings here
const result = await convertFromDirectory({
schemaDirectory: "./src/schemas",
typeOutputDirectory: "./src/interfaces",
debug: true,
defaultToRequired: true,
indexAllToRoot: true,
});
if (result) {
console.log("Completed joi-to-typescript");
} else {
console.log("Failed to run joi-to-typescript");
}
};
types();
with version 1.10.1
Reverting back to the previous version solves the problem
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
TS cannot find modules - typescript - Stack Overflow
I have ran the generator with the following environment: typescript, react, webpack w/ NPM, gulp. When I run gulp serve I get the...
Read more >Cannot find module 'typescript' · Issue #707 - GitHub
when I execute: $ npx ts-node, it throwing Cannot find module 'typescript' ... Error: Cannot find module 'typescript' at Function.Module.
Read more >cannot find module [Node npm Error Solved] - freeCodeCamp
In my case, I got it like this "Module not found: Error: Can't resolve 'react-icons/fa' in 'C:\Users\user\Desktop\Projects\Address Locator\ ...
Read more >Fixing The "Cannot Find Module" Error In TypeScript
The first thing to fix the "cannot find module" error in TypeScript is to ensure that the package is installed on your system....
Read more >Fix Global Installs Not Working | "Cannot find module" error FIX
Getting " Cannot find module " after installing something globally (with -g)? Well, this video shows you how to fix global package/module ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thankyou for the bug report, this has now been fixed with version 1.10.3
Thankyou for the kind words 👍