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.

Problems with using npm to install/import the library.

See original GitHub issue

Describe the bug I tried to use the library through npm and have found a few issues.

To Reproduce Steps to reproduce the behavior:

  1. import npm i html5-qrcode
  2. Try importing the library like import Html5QrcodeScanner from 'html5-qrcode'
  3. Get a module not found error
  4. Change import to import Html5QrcodeScanner from 'html5-qrcode/minified/html5-qrcode.min'
  5. Get a module build failure

Expected behavior import Html5QrcodeScanner from 'html5-qrcode' or at least giving the specific path inside the module should work.

Additional context The first error is likely due to the main property of the package.json being set to "html5-qrcode.js" which does not exist.
The minified file I tried to import is the only java script file that is inside the folder in node_modules.

Here’s also a screenshot of the build failure: Screenshot 2020-11-13 at 11 59 29

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
tekookcommented, Mar 17, 2021

Any update on this @mebjas ?

8reactions
georgeweicommented, Dec 16, 2020

@Vincz You can try this to manually import the source code into your project:

  1. Download third-party/qrcode.js, src/html5-qrcode.js & src/html5-qrcode-scanner.js
  2. Modify these 3 files as the attached picture
  3. import Html5Qrcode or Html5QrcodeScanner in your code 1

@mebjas I have submitted a PR, please check.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NPM doesn't install module dependencies - Stack Overflow
I had an issue where manually installing a package had created a package-lock.json file after updating to node 8.0.0 and npm 5.0.0. After...
Read more >
Common errors | npm Docs
Some strange issues can be resolved by simply running npm cache clean and trying again. If you are having trouble with npm install...
Read more >
How to Solve the Global npm Module Dependency Problem
The first thing you need to do is remove that -g when you install modules. You should replace that with --save-dev so you...
Read more >
How To Use Node.js Modules with npm and package.json
Use `npm install <pkg>` afterwards to install a package and save it as a dependency in the package.json file. Press ^C at any...
Read more >
Manage npm packages - Visual Studio (Windows)
To help identify errors, check the npm Output window when installing the packages, as described previously in this article. For example, if one ......
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