epfromer / pst-extractor

Extract objects from MS Outlook/Exchange PST files
59 stars 18 forks source link

Error: Cannot find module #7

Closed idoor88 closed 4 years ago

idoor88 commented 4 years ago

/Users/testing/node-v12.13.1-darwin-x64/bin/node --experimental-modules test.mjs (node:4149) ExperimentalWarning: The ESM module loader is experimental. internal/modules/esm/default_resolve.js:84 let url = moduleWrapResolve(specifier, parentURL); ^

Hi, thanks for the library, I tried to run the test.ts, but got some errors, first of all, my node version is v12.13.1, but got a couple of errors, like: import * as fs from 'fs'; ^^^^^^ SyntaxError: Cannot use import statement outside a module, then I changed test.ts to test.mjs, and added --experimental-modules, then I got another error: function processFolder(folder: PSTFolder) { ^ SyntaxError: Unexpected token ':'

so I changed the function to: function processFolder(folder) { also changed other similar things by removing : PSTMessage, :string, ... function doSaveToFS(msg: PSTMessage, emailFolder: string, sender: string, recipients: string) {

now finally I got the following error:

Error: Cannot find module /Users/testing/Downloads/pst-extractor-1.5.0/src/PSTAttachment/PSTAttachment.class imported from /Users/testing/Downloads/pst-extractor-1.5.0/src/test.mjs at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:84:13) at Loader.resolve (internal/modules/esm/loader.js:73:33) at Loader.getModuleJob (internal/modules/esm/loader.js:147:40) at ModuleWrap. (internal/modules/esm/module_job.js:41:40) at link (internal/modules/esm/module_job.js:40:36) { code: 'ERR_MODULE_NOT_FOUND'

Any clues?

Thanks

idoor88 commented 4 years ago

Got it working, thanks