Import error on typescript environment
See original GitHub issueI’m use:
- node v14.5.0,
- typescript v3.9.6
- ts-node v8.10.2
on a Windows 10 system, and when I only import Minisearch like:
import Minisearch from 'minisearch';
I get the follow error on try run with ts-node:
const searcher = new Minisearch({
^
TypeError: minisearch_1.default is not a constructor
at Object.<anonymous> (C:\Users\farin\atla\bercario\bot\src\internals\Searcher.ts:8:18)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Module.m._compile (C:\Users\farin\atla\bercario\bot\node_modules\ts-node\src\index.ts:858:23)
at Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\farin\atla\bercario\bot\node_modules\ts-node\src\index.ts:861:12)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)
at Module.require (internal/modules/cjs/loader.js:1090:19)
at require (internal/modules/cjs/helpers.js:75:18)
Can anyone help me? I’m not know if I’m doing something wrong and I can’t imagine how to fix that.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import refers to. Consider an import statement like import {...
Read more >Typescript: Cannot use import statement outside a module
The error means Node found an import statement in a file that it does not consider an ECMAScript (ES) module. Adding "type": "module"...
Read more >TypeScript errors and how to fix them
This error occurs when you import the same file in two different files using two different casing styles (ex. camelCase and UpperCamelCase):.
Read more >File is not a module error in TypeScript | bobbyhadz
The error "File is not a module" simply means that the file does not contain any export or import statements. Any file that...
Read more >False errors in Typescript files, import statements are not ...
While working with Typescript I import dependencies from other files. Resharper grays them out as not used and then further in the code...
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
Hello folks,
I just encountered the same issue when I tried to test (using Jest) angular service that operates with MiniSearch library. I was able to fix the issue by substituting my
tsconfig.spec.json
withI remove the node_modules and try install again, and works. Thanks.