Skip to content

How to install the library having angular 14 #563

Open

Description

@vladyslav-fenchak

Hello.
I have a question about the library. The last release I see is 3 years old, however in master it is updated to be compatible with version 14 of angular.
Can you tell me how I can use this library with angular 14?

Thanks.

Activity

  1. b-turchyn commented on Nov 4, 2022

    @b-turchyn

    I haven't seen much movement in this repo recently unfortunately, so I'm not sure when/if a new version will be updated.

    In general though, NPM can install packages from GitHub repos with the following syntax:

    # From the main/master primary branch
    npm install neroniaky/angular-token # main/master
    # From a specific branch
    npm install neroniaky/angular-token#branch
  2. KOVIKO commented on Nov 16, 2022

    @KOVIKO

    @b-turchyn Were you able to actually do that for this repo and then make use of it?

    When I try, it creates an angular-token-app directory in node_modules that is nothing but *.json files, *.md files, config files, etc.

    image

  3. KOVIKO commented on Nov 17, 2022

    @KOVIKO

    This prompted me to start looking for a solution—other than --force or --legacy-peer-deps—to this issue and I've found something that works for me!

    As of NPM 8 (~8.3), there's been the ability to set overrides in package.json to override dependencies of your dependencies. Personally, I had no idea. 🤣 You can manually set version strings, or you can use the special character $ to reference whatever version you are currently using in dependencies.

    package.json

    {
      "scripts": {
        ...
      },
      "dependencies": {
        "@angular/common": "^14.2.10",
        "@angular/compiler": "^14.2.10",
        "@angular/core": "^14.2.10",
        "angular-token": "^7.0.1",
        ...
      },
      "devDependencies": {
        ...
      },
      "overrides": {
        "angular-token": {
          "@angular/common": "$@angular/common",
          "@angular/compiler": "$@angular/compiler",
          "@angular/core": "$@angular/core"
        }
      }
    }

    It's worth noting that the overrides section of the config does not appear to have any effect on the resulting package-lock.json/npm-shrinkwrap.json. As such, if you want to be able to run npm ci, you must include the package.json in your container. The package-lock.json/npm-shrinkwrap.json file is not enough.

    I also personally found that I had to include tslint in my devDependencies for angular-token to install via this method. The error messages from NPM made this abundantly clear, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions