Cannot find module './types.json'
See original GitHub issueI installed the module (fs, util, mime) in shared folder written the below script
var fs = require("fs"),
util = require("util");
var mime = require("mime");
var dataUri = base64Image("/home/arvindan/testing/abc.jpg");
console.log(dataUri);
function base64Image(src) {
var data = fs.readFileSync(src).toString("base64");
return util.format("data:%s;base64,%s", mime.lookup(src), data);
}
on execution throwing below error Error: Cannot find module ‘./types.json’ at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/arvindan/node_modules/mime/mime.js:87:13) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17)
please help me to resolve the issue
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Solved: "Cannot find module 'x.json'" TypeScript Error
When trying to import a JSON file in your TypeScript project, you may see the following error: Cannot find module 'my-json-file.json'.
Read more >require a json file results in an error: Cannot find module
I tried to: add "resolveJsonModule": true to the compilerOptions in jsconfig.json , but it does not work.
Read more >Cannot find module 'X' Error in TypeScript | bobbyhadz
The "Cannot find module or its corresponding type declarations" error occurs when TypeScript cannot locate a third-party or local module in our project....
Read more >cannot find module [Node npm Error Solved] - freeCodeCamp
you're trying to import an item from a module you don't have installed in your project directory; you're importing some things from an...
Read more >Fixing The "Cannot Find Module" Error In TypeScript
Fixing The "Cannot Find Module" Error In TypeScript · The package is not installed. · Something is wrong with the node_modules folder. ·...
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 FreeTop 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
Top GitHub Comments
I fixed this error with
$ npm install mime
.Try