Code Monkey home page Code Monkey logo

Comments (19)

Stan92 avatar Stan92 commented on May 25, 2024 1

Describe the bug
The module can't be found using the command
import { BluetoothCore } from '@manekinekko/angular-web-bluetooth'

Even if I get the right version (9.1.0) using the command
npm info @manekinekko/angular-web-bluetooth version

To Reproduce

npm i -S @manekinekko/angular-web-bluetooth @types/web-bluetooth

Within a component I add
import { WebBluetoothModule } from '@manekinekko/angular-web-bluetooth';

Running ng s, I get this error

ERROR in src/app/app.component.ts:2:31 - error TS2307: Cannot find module '@manekinekko/angular-web-bluetooth'.

import { BluetoothCore } from '@manekinekko/angular-web-bluetooth';
src/app/app.module.ts:6:36 - error TS2307: Cannot find module '@manekinekko/angular-web-bluetooth'.


Desktop (please complete the following information):

  • OS: Windows 10 & Ubuntu 18.04
  • Angular 8 & 9

from angular-web-bluetooth.

developersnively avatar developersnively commented on May 25, 2024 1

Hi, same problem for me. Angular 9.1.0 on Mac Catalina 10.15.4

from angular-web-bluetooth.

ankiitbansal avatar ankiitbansal commented on May 25, 2024 1

from angular-web-bluetooth.

rjstalb avatar rjstalb commented on May 25, 2024 1

@manekinekko thanks! confirming this works. appreciate the responsiveness here :)

from angular-web-bluetooth.

manekinekko avatar manekinekko commented on May 25, 2024

Hi, would you mind using the issue template so we can have more details on how to reproduce this issue?

from angular-web-bluetooth.

manekinekko avatar manekinekko commented on May 25, 2024

FYI, both packages are available on NPM...
image

from angular-web-bluetooth.

Stan92 avatar Stan92 commented on May 25, 2024

Ok, I'll use the template... FYI, it worked with v7.0.0

from angular-web-bluetooth.

vpalaciopbcs avatar vpalaciopbcs commented on May 25, 2024

I have the same issue, just starting a new project and try to import the library to replicate the problem. I checked out the sample code and there works fine but I also see the folder structure is a little different and also you have the PATH property in tsconfig.json of the example.
Tested with angular 9

from angular-web-bluetooth.

drdreinhard avatar drdreinhard commented on May 25, 2024

Same to me. Angular 9

from angular-web-bluetooth.

the-bug avatar the-bug commented on May 25, 2024

After migrating a project from 7.0.0 to 9.1.0 this issues is happening there at well...

from angular-web-bluetooth.

Anavra avatar Anavra commented on May 25, 2024

Running the bluetooth starter directly from a clone of this repo seems to work fine, but I get this issue when adding it to my own project.

error TS2307: Cannot find module '@manekinekko/angular-web-bluetooth'.
11 import { BluetoothCore } from '@manekinekko/angular-web-bluetooth';
error TS2307: Cannot find module '@manekinekko/angular-web-bluetooth'.
110 import { WebBluetoothModule } from '@manekinekko/angular-web-bluetooth';
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR in app/app.module.ts(210,5): Error during template compile of 'AppModule'
  Could not resolve @manekinekko/angular-web-bluetooth relative to [object Object]..

@types/web-bluetooth is functioning correctly as the type definitions can be used with no problem. There must be something additional that needs to be done with the new angular.

from angular-web-bluetooth.

stephen-dirtcreative avatar stephen-dirtcreative commented on May 25, 2024

Same problem using yarn add with 9.1.0. Looking at the installed folder, it seems like the library code prior to build is being provided rather than the distribution ready code. Listing the directory at node_modules/@maneikinekko/angular-web-bluetooth gives:

.release-it.json
README.md
karma.conf.js
ng-package.json
package.json
src/
tsconfig.lib.json
tsconfig.spec.json
tslint.json

from angular-web-bluetooth.

Express85 avatar Express85 commented on May 25, 2024

I bump into the same issue. Is there already a solution to this problem?

from angular-web-bluetooth.

stephen-dirtcreative avatar stephen-dirtcreative commented on May 25, 2024

@Express85 I worked around the problem by cloning the Git repository, then manually adding the build output as a library to my project.

from angular-web-bluetooth.

ankiitbansal avatar ankiitbansal commented on May 25, 2024

same issue for me as well. using node version 14.4.
Tried installing, ununistalling the npm package, getting some different errors.

Any workaround please?

also @stephen-dirtcreative can you please share the build output that you are mentioning with some steps.

image

from angular-web-bluetooth.

stephen-dirtcreative avatar stephen-dirtcreative commented on May 25, 2024

@ankiitbansal Sure, or at least I'll try.

What I did:

  1. Clone the repo: git clone https://github.com/manekinekko/angular-web-bluetooth.git
  2. npm install and npm audit -- The 2 high severity vulnerabilities were fixable, at least on my platform, npm audit fix picked off 7 of 10 low vulnerabilities, also. I didn't attempt to address the remaining low vulnerabilities as they had to do with karma, protractor, and angular-build
  3. npm run prebuild -- This is the script in package.json for building the library project, it should output to [repo root]/dist/manekinekko/angular-web-bluetooth
  4. Copy the manekinekko folder that was created under [repo root]/dist to your Angular project's dist folder.
  5. Edit your tsconfig.json to include a section similar to the following:
{
  // ... skipping unrelated option settings ...
  "paths": {
    "angular-web-bluetooth": [
      "dist/manekinekko/angular-web-bluetooth/manekinekko-angular-web-bluetooth",
      "dist/manekinekko/angular-web-bluetooth"
    ]
  }
}

Don't forget it's a JSON file, so no trailing commas, and quotes matter. Also, just to be over-cautious: the '... skipping unrelated options settings ...' is NOT something to put in the file!

With the folder imported to your dist/ and configured in tsconfig.json, you should be able to import from 'angular-web-bluetooth'. For example, in src/app/app.module.ts I have:

import { WebBluetoothModule } from 'angular-web-bluetooth'

Make sure you have @types/web-bluetooth installed via your package manager. Hopefully, I didn't miss anything. Even more hopefully the next version bump of the package will resolve the issue either intentionally or just as a side-effect, and this won't be something anyone needs to rely on.

from angular-web-bluetooth.

rjstalb avatar rjstalb commented on May 25, 2024

Ultimately the issue is with using Ivy in Angular 9. I've found a work around running npm run prebuild with Ivy off, and then turning it back on for my local project (where I want to use Ivy)...

in tsconfig.json, add:

"angularCompilerOptions": { "enableIvy": false }

See Angular docs for reference

from angular-web-bluetooth.

manekinekko avatar manekinekko commented on May 25, 2024

The issue has been fixed. Please try the new version v9.1.1.

from angular-web-bluetooth.

manekinekko avatar manekinekko commented on May 25, 2024

Thank you @rjstalb

from angular-web-bluetooth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.