IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Angular Discussion :

Utilisation de ng add inefficace


Sujet :

Angular

  1. #1
    Membre chevronné
    Profil pro
    Développeur Web
    Inscrit en
    Février 2008
    Messages
    2 122
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Février 2008
    Messages : 2 122
    Points : 2 235
    Points
    2 235
    Par défaut Utilisation de ng add inefficace
    Bonjour tout le monde,
    J'ai créé un projet il y a deux ou trois ans pour interroger la météo, je remettrais bien ça histoire de m'assurer d'être encore opérationnel.
    Petit souci au moment de taper
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ng add service location
    Il m'est répondu :
    i Using package manager: npm
    √ Found compatible package version: service@0.1.4.
    √ Package information loaded.
    √ Package successfully installed.
    The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.
    J'ai vu quelque part que ça pouvait aider d'installer angular-cli-ghpages, mais que ça ne suffit pas en soi.

    Quelqu'un saurait-il répondre à la question "Mais encore ?" ?

    À ce stade voilà ce que j'ai dans le package.json :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    {
      "name": "weather-project",
      "version": "0.0.0",
      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "~11.2.5",
        "@angular/common": "~11.2.5",
        "@angular/compiler": "~11.2.5",
        "@angular/core": "~11.2.5",
        "@angular/forms": "~11.2.5",
        "@angular/platform-browser": "~11.2.5",
        "@angular/platform-browser-dynamic": "~11.2.5",
        "@angular/router": "~11.2.5",
        "rxjs": "~6.6.0",
        "service": "^0.1.4",
        "tslib": "^2.0.0",
        "zone.js": "~0.11.3"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "~0.1102.3",
        "@angular/cli": "~11.2.4",
        "@angular/compiler-cli": "~11.2.5",
        "@types/jasmine": "~3.6.0",
        "@types/node": "^12.11.1",
        "codelyzer": "^6.0.0",
        "jasmine-core": "~3.6.0",
        "jasmine-spec-reporter": "~5.0.0",
        "karma": "~6.1.0",
        "karma-chrome-launcher": "~3.1.0",
        "karma-coverage": "~2.0.3",
        "karma-jasmine": "~4.0.0",
        "karma-jasmine-html-reporter": "^1.5.0",
        "protractor": "~7.0.0",
        "ts-node": "~8.3.0",
        "tslint": "~6.1.0",
        "typescript": "~4.1.5"
      }
    }

  2. #2
    Membre éprouvé
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2019
    Messages
    707
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2019
    Messages : 707
    Points : 1 030
    Points
    1 030
    Par défaut
    pour créer un service je fais :


    * ng add installe un package npm et ensuite il fait quelques configurations dans ton dossier du projet (modif de fichier, ajout de fichier...)
    par exemple : ng add @angular/pwa

    * npm i ...........
    installe un package et ne fait rien d'autres

    * ng add service location
    j'ai regardé sur internet, ça ne correspond à rien

  3. #3
    Membre chevronné
    Profil pro
    Développeur Web
    Inscrit en
    Février 2008
    Messages
    2 122
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Février 2008
    Messages : 2 122
    Points : 2 235
    Points
    2 235
    Par défaut
    Bon, voilà :
    D:\Projects Visual Studio\Web\WeatherProject021\WeatherProject021\WeatherClient\src\app
    12:01:36>ng add @angular/pwa
    i Using package manager: npm
    √ Found compatible package version: @angular/pwa@latest.
    √ Package information loaded.
    √ Package successfully installed.
    Option "configuration" is deprecated: No longer has an effect.
    CREATE ngsw-config.json (624 bytes)
    CREATE src/manifest.webmanifest (1350 bytes)
    CREATE src/assets/icons/icon-128x128.png (1253 bytes)
    CREATE src/assets/icons/icon-144x144.png (1394 bytes)
    CREATE src/assets/icons/icon-152x152.png (1427 bytes)
    CREATE src/assets/icons/icon-192x192.png (1790 bytes)
    CREATE src/assets/icons/icon-384x384.png (3557 bytes)
    CREATE src/assets/icons/icon-512x512.png (5008 bytes)
    CREATE src/assets/icons/icon-72x72.png (792 bytes)
    CREATE src/assets/icons/icon-96x96.png (958 bytes)
    UPDATE angular.json (3930 bytes)
    UPDATE package.json (1313 bytes)
    UPDATE src/app/app.module.ts (789 bytes)
    UPDATE src/index.html (481 bytes)
    √ Packages installed successfully.

    D:\Projects Visual Studio\Web\WeatherProject021\WeatherProject021\WeatherClient\src\app
    12:03:33>ng add service location
    Skipping installation: Package already installed
    The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.

    D:\Projects Visual Studio\Web\WeatherProject021\WeatherProject021\WeatherClient\src\app
    12:04:20>

  4. #4
    Membre éprouvé
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2019
    Messages
    707
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2019
    Messages : 707
    Points : 1 030
    Points
    1 030
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    npm uninstall -g angular-cli
     npm cache verify
     npm install -g @angular/cli@latest

  5. #5
    Membre chevronné
    Profil pro
    Développeur Web
    Inscrit en
    Février 2008
    Messages
    2 122
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Février 2008
    Messages : 2 122
    Points : 2 235
    Points
    2 235
    Par défaut
    Ça paraissait prometteur, merci, mais on dirait qu'il doit encore manquer quelque chose ...

    12:50:25>npm install -g @angular/cli@latest
    npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
    npm WARN deprecated har-validator@5.1.5: this library is no longer supported
    C:\Users\admin\AppData\Roaming\npm\ng -> C:\Users\admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng

    > @angular/cli@12.1.2 postinstall C:\Users\admin\AppData\Roaming\npm\node_modules\@angular\cli
    > node ./bin/postinstall/script.js

    + @angular/cli@12.1.2
    added 14 packages from 7 contributors, removed 16 packages and updated 46 packages in 17.039s
    12:51:12>ng add service location
    Your global Angular CLI version (12.1.2) is greater than your local version (11.2.14). The local Angular CLI version is used.

    To disable this warning use "ng config -g cli.warnings.versionMismatch false".
    Skipping installation: Package already installed
    The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.

  6. #6
    Membre éprouvé
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2019
    Messages
    707
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2019
    Messages : 707
    Points : 1 030
    Points
    1 030
    Par défaut
    npm uninstall --save-dev angular-cli
    npm install --save-dev @angular/cli@latest
    npm install

  7. #7
    Membre chevronné
    Profil pro
    Développeur Web
    Inscrit en
    Février 2008
    Messages
    2 122
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Février 2008
    Messages : 2 122
    Points : 2 235
    Points
    2 235
    Par défaut
    On va bien y arriver ...
    D:\Projects Visual Studio\Web\WeatherProject021\WeatherProject021\WeatherClient\src\app\Shared\Services
    12:51:28>npm uninstall --save-dev angular-cli
    npm WARN karma-jasmine-html-reporter@1.7.0 requires a peer of jasmine-core@>=3.8 but none is installed. You must install peer dependencies yourself.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

    audited 1469 packages in 7.962s

    87 packages are looking for funding
    run `npm fund` for details

    found 2 moderate severity vulnerabilities
    run `npm audit fix` to fix them, or `npm audit` for details

    D:\Projects Visual Studio\Web\WeatherProject021\WeatherProject021\WeatherClient\src\app\Shared\Services
    13:49:41>npm install --save-dev @angular/cli@latest

    > @angular/cli@12.1.2 postinstall D:\Projects Visual Studio\Web\WeatherProject021\WeatherProject021\WeatherClient\node_modules\@angular\cli
    > node ./bin/postinstall/script.js

    npm WARN karma-jasmine-html-reporter@1.7.0 requires a peer of jasmine-core@>=3.8 but none is installed. You must install peer dependencies yourself.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

    + @angular/cli@12.1.2
    added 33 packages from 7 contributors, removed 16 packages, updated 12 packages and audited 1486 packages in 18.562s

    90 packages are looking for funding
    run `npm fund` for details

    found 2 moderate severity vulnerabilities
    run `npm audit fix` to fix them, or `npm audit` for details

    D:\Projects Visual Studio\Web\WeatherProject021\WeatherProject021\WeatherClient\src\app\Shared\Services
    13:50:02>npm install
    npm WARN karma-jasmine-html-reporter@1.7.0 requires a peer of jasmine-core@>=3.8 but none is installed. You must install peer dependencies yourself.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

    audited 1486 packages in 7.844s

    90 packages are looking for funding
    run `npm fund` for details

    found 2 moderate severity vulnerabilities
    run `npm audit fix` to fix them, or `npm audit` for details

    D:\Projects Visual Studio\Web\WeatherProject021\WeatherProject021\WeatherClient\src\app\Shared\Services
    13:50:13>ng add service location
    Skipping installation: Package already installed
    The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.
    Il n'y a plus de packages.json, mais à la place un packages.config :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.Mvc.fr" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.Razor.fr" version="3.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebApi" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebApi.Client.fr" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebApi.Core.fr" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebApi.WebHost.fr" version="5.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net471" />
      <package id="Microsoft.AspNet.WebPages.fr" version="3.2.7" targetFramework="net471" />
      <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net471" />
      <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net471" />
      <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net471" />
    </packages>

  8. #8
    Membre chevronné
    Profil pro
    Développeur Web
    Inscrit en
    Février 2008
    Messages
    2 122
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Février 2008
    Messages : 2 122
    Points : 2 235
    Points
    2 235
    Par défaut
    Citation Envoyé par krakatoa Voir le message
    * ng add service location
    j'ai regardé sur internet, ça ne correspond à rien
    Ah pardon, je n'avais pas prêté attention.
    C'est vrai que c'est ng generate service, et là ça marche.

    Eh bien j'ai bien fait de m'y remettre, ça commençait à bien rouiller tout ça.

    Désolé d'avoir fait perdre du temps ...

  9. #9
    Membre éprouvé
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2019
    Messages
    707
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2019
    Messages : 707
    Points : 1 030
    Points
    1 030
    Par défaut
    pas de soucis.
    et oui, suffit qu'on arrete quelques semaines et on perd !

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. LINQ - Pas de méthode Add ?
    Par Nalfeim dans le forum Accès aux données
    Réponses: 1
    Dernier message: 23/05/2008, 12h17
  2. Réponses: 1
    Dernier message: 10/02/2008, 14h56
  3. dataset add row ne pas ajouter de clé double?
    Par gregcat dans le forum Windows Forms
    Réponses: 2
    Dernier message: 30/01/2008, 11h25
  4. [PDF - itext] Ne pas allez a ligne apres add
    Par toflofr dans le forum Documents
    Réponses: 1
    Dernier message: 15/05/2006, 10h26
  5. [SWING] jframe.add() ne fonctionne pas
    Par thomfort dans le forum Agents de placement/Fenêtres
    Réponses: 1
    Dernier message: 21/04/2006, 00h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo