facebook twitter hatena line email

「Monaca/コマンド」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(デバッグ)
(プレビュー時のエラー)
 
(同じ利用者による、間の3版が非表示)
行8: 行8:
 
  monaca login
 
  monaca login
 
  monaca import
 
  monaca import
 +
 +
既にCloudIDEに上げてるproject名を選択
  
 
==プレビュー==
 
==プレビュー==
行19: 行21:
  
 
===プレビュー時のエラー===
 
===プレビュー時のエラー===
Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com  'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-GBZpdGLls8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
+
Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com  'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-GBZpdGLls8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
  
 
www/index.html
 
www/index.html
行44: 行46:
 
以下でブラウザアクセス
 
以下でブラウザアクセス
 
  10.0.1.21:8001
 
  10.0.1.21:8001
 +
 +
===デバッグ時にwebkitがないエラーが出たら===
 +
以下のようなwebkitがないエラーが出たら
 +
Node Webkit is not installed
 +
以下コマンドを実行
 +
npm install nw@0.26.6
  
 
==リモードビルド==
 
==リモードビルド==
行60: 行68:
 
   $ monaca remote build android --skipUpload
 
   $ monaca remote build android --skipUpload
 
   $ monaca remote build --browser --skipTranspile
 
   $ monaca remote build --browser --skipTranspile
 
==webkitがないエラーが出たら==
 
以下のようなwebkitがないエラーが出たら
 
Node Webkit is not installed
 
以下コマンドを実行
 
npm install nw@0.26.6
 

2020年5月21日 (木) 14:41時点における最新版

CLIでの操作

公式マニュアル

https://docs.monaca.io/ja/products_guide/monaca_cli/cli_commands/

セットアップとログインとインポート

npm i -g monaca
monaca login
monaca import

既にCloudIDEに上げてるproject名を選択

プレビュー

monaca preview

以下エラーが出たらupdateする Project preview failed: Your project was created using Monaca CLI 2.x so you need to update your project ('monaca update') or downgrading your Monaca CLI version to 2.x.

以下URLとかでプラウザが起動する

ttp://localhost:8080/

プレビュー時のエラー

Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com  'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-GBZpdGLls8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.

www/index.html

修正前

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">

修正後

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">

参考:https://github.com/phonegap/phonegap-app-desktop/issues/801

monaca本体のupdate

monaca update
monaca version
3.3.2

プロジェクトアップロード

以下で差分があれば全uploadされる

monaca upload

デバッグ

monaca debug

以下でブラウザアクセス

10.0.1.21:8001

デバッグ時にwebkitがないエラーが出たら

以下のようなwebkitがないエラーが出たら

Node Webkit is not installed

以下コマンドを実行

npm install nw@0.26.6

リモードビルド

monaca remote build

色々なビルドができる

 $ monaca remote build ios
 $ monaca remote build ios --build-type=debug
 $ monaca remote build android --build-type=debug --android_webview=crosswalk --android_arch=arm
 $ monaca remote build pwa --build-type=release
 $ monaca remote build electron_windows
 $ monaca remote build electron_macos
 $ monaca remote build electron_linux
 $ monaca remote build --browser
 $ monaca remote build --build-list
 $ monaca remote build android --skipUpload
 $ monaca remote build --browser --skipTranspile