Unable to import the library
See original GitHub issueHi,
I have installed the library through npm, and now I am trying to import the library in a typescript project by importing the ES6 module:
import { BrowserQRCodeReader, Result } from "@zxing/library";
Typescript compiles my code correctly, but apparently the library doesn’t get imported. At runtime I get a console error in the browser that the module is not found: Uncaught Error: Cannot find module ‘@zxing/library’.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
python - Unable to import a module that is definitely installed
Open up Terminal · Type open .bash_profile · In the text file that pops up, add this line at the end: export PYTHONPATH=$PYTHONPATH:/System/Library/Frameworks/ ......
Read more >Resolve "Unable to import module" errors from Python ... - AWS
I receive an "Unable to import module" error when I try to run my AWS Lambda code in Python. How do I resolve...
Read more >Unable to Import the Selected Library - TechSmith Support
Solution. Camtasia 2018 and later cannot import libzip files from Camtasia Studio 8. In order to get Camtasia Studio 8 library content into ......
Read more >unable to import from installed library in node_modules ...
For TS/JS-portable code, importing from a package index/main file is bad practice: it imports everything by default and does not tree-shake like the...
Read more >Unable to import the libraries correctly - Arduino Forum
The problem is that you have not installed the library. I see you have copied the library files into the sketch 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
@odahcam Hi, and first of all, thank you for your answer.
The problem I had was not that I couldn’t compile the code in typescript, both the ide and the project build were not showing errors. The problem I saw was that at runtime I could see an error in the console stating that the @zxing/library module could not be found.
For 2 hours I tried to fix it without success, until I decided to switch to a different library that worked.
Today I tried again to install the library and use it, in order to give you more hints for this issue, and everything works fine… Apologies, I must have had some issue with my dev environment, or the build tool i use (Meteor) maybe did something funky.
Anyway, I cannot reproduce it so I am going to close the issue. The library looks really nice by the way, keep up the good work!
Yes it does, the package comes with typings so it can be interpreted gracefully in TypeScript projects. The only problem here is if your project is a TypeScript project and if it’s configured to load node_modules’s packages. Since I cannot understand exactly what’s your problem I’d like to request a demo so we can figure out a solution for your case.