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.

Using Yarn workspaces results in: Error: method not available in web

See original GitHub issue

Describe the bug All methods yield just Error: method not available in web.

To Reproduce Use any methods of the plugin. EDIT: I’m using just prepare, hide/show-Background and startScan methods.


I’m using Capacitor.js@2.4.7 and @capacitor-community/barcode-scanner@1.2.1, here is the full list of yarn cap doctor

💊   Capacitor Doctor  💊 

Installed Dependencies:

  @capacitor/cli 2.4.7
  @capacitor/core 2.4.7
  @capacitor/android 2.4.7
  @capacitor/ios 2.4.7
  @capacitor/electron not installed

[success] Android looking great! 👌
  Found 10 Capacitor plugins for ios:
    @capacitor-community/barcode-scanner (1.2.1)
    capacitor-dark-mode (1.0.5)
    capacitor-plugin-ios-swipe-back (1.0.3)
    capacitor-rate-app (0.1.1)
    capacitor-secure-storage-plugin (0.5.0)
    cordova-plugin-appcenter-crashes (0.5.1)
    cordova-plugin-appcenter-shared (0.5.1)
    cordova-plugin-fingerprint-aio (4.0.2)
    cordova-plugin-inappbrowser (5.0.1-dev)
    onesignal-cordova-plugin (2.11.3)
[success] iOS looking great! 👌

Desktop (please complete the following information):

I’m using Yarn@1 with workspaces feature in a monorepo.

    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 439.66 MB / 32.00 GB
    Shell: 3.1.2 - /usr/local/bin/fish
    Brave Browser:
    Chrome: 91.0.4472.114
    Edge: 91.0.864.54
    Firefox: 85.0.2
    Safari: 14.1.1

Smartphone (please complete the following information):

Tested on one physical device

  • Device: Samsung SM-J330F
  • OS: Android 8.0
  • WebView implementation with Chrome 91.0.4472.120

And on an Apple simulator

  • Device: iPhone 11
  • OS: iOS 14.5

And on an Android emulator

  • Device: Pixel 3
  • OS: Android 11

Additional context I read the logs for anything “barcode” related but no trace of warning/error. I also double-checked the setup and all seems to be OK.

Issue Analytics

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

github_iconTop GitHub Comments

jehadjacommented, Jan 30, 2022

@NicoP-S Hi, mostly you are using documentation for the new version to implement the old version you are using capacitor v2

so you need to use this documentation

fast fix steps need to do

 npm i @capacitor-community/barcode-scanner@1.2.1
 npx cap sync

in your main activity

 import com.dutchconcepts.capacitor.barcodescanner.BarcodeScanner;

the calling of BarcodeScanner is not as v3 instead of import { BarcodeScanner } from '@capacitor-community/barcode-scanner'; use

 import { Plugins } from "@capacitor/core";
    async startScan() {
      const { BarcodeScanner } = Plugins;
      const prem = await this.didUserGrantPermission();
      if (prem) {
        const result = await BarcodeScanner.startScan();
        if (result.hasContent) {
      } else {

tafelnlcommented, Jul 12, 2021

Would you be able to, instead of sharing the whole repo, share a minimal reproduction repo (with any confidential code stripped out)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Yarn Workspaces, workspace does not emit errors or warnings
For some reason if I use error boundaries I get an error: Failed to load config "./node_modules/kcd-scripts/eslint.js" to extend from.
Read more >
Workspaces - Yarn
Workspaces are a new way to set up your package architecture that's available by default starting from Yarn 1.0. It allows you to...
Read more >
Support yarn workspaces (better indexing of node_modules ...
What steps will reproduce the problem? 1. Create a multi-package workspace project with yarn workspaces 2. Try and import code between different projects, ......
Read more >
JavaScript package managers compared: npm, Yarn, or pnpm?
The following tables compare a curated set of different CLI commands available in npm, Yarn Classic, Yarn Berry, and pnpm. This is by...
Read more >
module-not-found - Next.js
Why This Error Occurred · The module you're trying to import is not installed in your dependencies · The module you're trying to...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found