question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to import the library

See original GitHub issue

Hi,

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:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MastroLinduscommented, Jul 21, 2018

@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!

0reactions
odahcamcommented, Sep 10, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found