facebook twitter hatena line email

Monaca/コマンド

提供: 初心者エンジニアの簡易メモ
2020年5月20日 (水) 18:11時点におけるAdmin (トーク | 投稿記録)による版 (プレビュー)

移動: 案内検索

CLIでの操作

公式マニュアル

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

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

npm i -g monaca
monaca login
monaca import

プレビュー

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
 > monaca preview      => Run app in the browser
 > monaca debug        => Run app in the device using Monaca Debugger
 > monaca remote build => Start remote build for iOS/Android/Windows
 > monaca upload       => Upload this project to Monaca Cloud IDE

monaca update

デバッグ

monaca debug

webkitがないエラーが出たら

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

Node Webkit is not installed

以下コマンドを実行

npm install nw@0.26.6