Ionicは、高品質のクロスプラットフォームネイティブおよびWebアプリを構築するための無料のオープンソースフレームワークです。簡単なコマンドからプロジェクトを作成するのに役立つ強力なコマンドラインインターフェイスが付属しています。 Ionicは、アプリを開発するためにAndroid、IOS、およびユニバーサルWindowsプラットフォームをサポートしています。 IonicはCardovaプラグインを使用して、カメラ、GPS、懐中電灯にアクセスします。
この投稿では、Debian10サーバーにIonicMobileAppFrameworkをインストールする方法を紹介します。
- Debian10を実行しているサーバー。
- ルートパスワードはサーバーで構成されています。
まず、次のコマンドを実行して、システムパッケージを更新されたバージョンに更新します。
apt-get update -y
すべてのパッケージが更新されたら、次のコマンドを使用して他の必要なパッケージをインストールできます。
apt-get install curl gnupg2 wget -y
Node.jsをインストール
次に、Node.jsをシステムにインストールする必要があります。デフォルトでは、Node.jsの最新バージョンはDebianリポジトリに含まれていません。そのため、ノードソースリポジトリをシステムに追加する必要があります。
次のコマンドを使用して、ノードソースリポジトリを追加できます。
curl -sL https://deb.nodesource.com/setup_14.x | bash -
リポジトリが追加されたら、次のコマンドを使用してNode.jsをインストールします。
apt-get install nodejs -y
Node.jsをインストールした後、次のコマンドを使用してNode.jsのバージョンを確認します。
node --version
次の出力が表示されます。
v14.17.1
次に、Cordovaをシステムにインストールする必要もあります。次のコマンドでインストールできます:
npm install -g cordova
インストールしたら、次のステップに進むことができます。
IonicFrameworkをインストールする
まず、サーバーにionicCLIユーティリティをインストールする必要があります。次のコマンドでインストールできます:
npm i -g @ionic/cli
ionicをインストールした後、次のコマンドでionicバージョンを確認します。
ionic -v
次の出力が得られるはずです:
6.16.3
Ionicでプロジェクトを作成する
これで、次のコマンドを使用して最初のプロジェクトを作成できます。
ionic start
ReactまたはAngularの間でフレームワークを選択し、プロジェクト名を指定して、以下に示すようにテンプレートを選択するように求められます。
Pick a framework! ???? Please select the JavaScript framework to use for your new app. To bypass this prompt next time, supply a value for the --type option. ? Framework: Angular Every great app needs a name! ???? Please enter the full name of your app. You can change this at any time. To bypass this prompt next time, supply name, the first argument to ionic start. ? Project name: myapp Let's pick the perfect starter template! ???? Starter templates are ready-to-go Ionic apps that come packed with everything you need to build your app. To bypass this prompt next time, supply template, the second argument to ionic start. ? Starter template: tabs ? Preparing directory ./myapp in 3.69ms ? Downloading and extracting tabs starter in 591.18ms ? Integrate your new app with Capacitor to target native iOS and Android? No Your Ionic app is ready! Follow these next steps: - Go to your new project: cd ./myapp - Run ionic serve within the app directory to see your app in the browser - Run ionic capacitor add to add a native iOS or Android project using Capacitor - Generate your app icon and splash screens using cordova-res --skip-config --copy - Explore the Ionic docs for components, tutorials, and more: https://ion.link/docs - Building an enterprise app? Ionic has Enterprise Support and Features: https://ion.link/enterprise-edition
次に、ディレクトリをプロジェクトに変更し、次のコマンドでアプリケーションを起動します。
cd myapp
ionic serve --host 0.0.0.0 --port 8100,/p>
次の出力が得られるはずです:
> ng run app:serve --host=0.0.0.0 --port=8100 [INFO] Development server running! Local: http://localhost:8100 External: http://216.98.11.73:8100 Use Ctrl+C to quit this process [INFO] Browser window opened to http://localhost:8100!
次に、Webブラウザーを開き、URL http:// your-server-ip:8100を使用してアプリケーションにアクセスします。 。次の画面にイオンアプリケーションが表示されます。
おめでとう!これで、IonicフレームワークがDebian10サーバーに正常にインストールされました。これで、Ionicフレームワークを使用してモバイルアプリケーションの作成を開始できます。