# ローカル サーバにプラグインをホストする

クローンとして作成したプラグインを FormIt でプレビューする前に、ローカル サーバにホストする必要があります。

### **IDE でターミナルを表示する**

別のターミナル ウィンドウではなく、Visual Studio Code 内でサーバを開始するオプションがあります。 \*\*\*\* ターミナルを開く前に、適切なフォルダが Visual Studio Code で開いていることを確認してください。

\[表示] > \[ターミナル] (またはキーボード ショートカット\[Ctrl]+\[\`])

![](https://github.com/FormIt3D/autodesk-formit-windows-help/blob/master-jpn/.gitbook/assets/image%20\(11\)%20\(1\).png)

### HTTP サーバを設定する

正常に動作する HTTP サーバは、npm の [http-server](https://www.npmjs.com/package/http-server) です。

[NodeJS](https://nodejs.org/en/) がまだインストールされていない場合は、ダウンロードしてインストールする必要があります。

次の手順でエラーが発生した場合は、コンピュータを再起動して NodeJS のインストールを完了してください。

コマンド プロンプトで、次のように入力して npm の *http-server* をグローバルにインストールします(1 回限りの設定)。

* `npm install http-server -g`

![](/files/VAN6aV0mpPmfN8vEHKfk)

### ローカル サーバを起動する

設定が完了したら、ターミナルで次のコマンドを実行して npm の http-server を起動します。

* `http-server`

![](/files/Od8l6MCqvPjFffyP7raP)

ヒント 1: http-server を実行する際に問題が発生した場合は、インストールがグローバルでもローカルでも、npx を使用して直接実行するとうまくいく場合があります。

* `npx http-server`

ヒント 2: Windows 10/11 ユーザが新しいコンピュータでスクリプトを実行するときにエラーが発生した場合は、設定が無効になっていることが原因である可能性があります。そのためには、次のようにします。

* PowerShell スクリプトを管理者として起動します。
* 次のように入力します: `Set-ExecutionPolicy RemoteSigned`

### FormIt Web 用の開発

FormIt Web 用に開発するには、代わりに次のコマンドを実行します。

* `http-server --cors`

![](https://github.com/FormIt3D/autodesk-formit-windows-help/blob/master-jpn/.gitbook/assets/image%20\(10\)%20\(1\).png)

### サーバを確認する

Web ブラウザで次のアドレスにナビゲートすると、サーバを確認できます。

* <http://localhost:8080>

ブラウザのウィンドウにプロジェクト フォルダのファイルが表示されます。

\*\* npm 以外の Web サーバを使用している場合は、既定のアドレス/ポートが異なる可能性があります。

![](/files/OvZO7hCAqF5x3OykUnwG)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://windows.help.formit.autodesk.com/ja/plugins/how-to-develop-plugins/advanced-development/hosting-a-plugin-on-a-local-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
