Ionic Tips: Use Ionic CLI as locally

Every documents and blogs tell us to install Ionic CLI as globaly. But, sometime we want use it as locally. Us […]

広告ここから
広告ここまで

目次

    Every documents and blogs tell us to install Ionic CLI as globaly.

    But, sometime we want use it as locally.

    Use npm-script instead

    We can easy to use Ionic CLI as locally by using npm-script.

    // Create project
    $ npx @ionic/cli start
    $ cd CREATED_PROJECT
    
    // Install CLI
    $ npm install -D @ionic/cli
    $  ./node_modules/.bin/ionic --help
    

    Edit package.json

    When you update your package.json file like this example, we can use Ionic CLI as locally more useful.

    {
      "name": "ionic-angular-scully",
      "version": "0.0.1",
      "author": "Ionic Framework",
      "homepage": "https://ionicframework.com/",
      "scripts": {
        "ng": "ng",
        "ionic": "ionic", // Add the line
    ...

    After that, we can use the CLI from npm run ionic.

    広告ここから
    広告ここまで

    Random posts

    Home
    Search
    Bookmark