# Preparing Ubuntu

## Installing Dependencies

{% code overflow="wrap" %}

```bash
sudo apt-get update | sudo apt-get upgrade
```

{% endcode %}

```bash
sudo apt install git | sudo apt install curl | sudo apt install -y libudev-dev
```

Next is to install npm. You can either install the latest version but I had issues with it, so this is the method I used. You can try both.

## Installing npm

```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | command -v nvm
```

^ You should see a version number output from this if successful ^

```bash
nvm install v18.17.0
```

{% hint style="info" %}
**Info:** Make sure you are in the directory you would like the repository in before running these commands. The repository is said to work best in the desktop folder, but you may choose.
{% endhint %}

## Cloning Repository and Preparing NPM

<pre class="language-bash"><code class="lang-bash"><strong>git clone https://github.com/rhysmorgan134/node-CarPlay.git | cd node-CarPlay | npm install | npm i | cd examples/carplay-web-app | npm i
</strong></code></pre>

## Cloning Repository and Preparing NPM (backup)

```bash
git clone https://github.com/ffluxxus/web-carplay.git | cd web-carplay | npm install | npm i | cd examples/carplay-web-app | npm i
```

{% hint style="warning" %}
**Warning:** You must be in the `examples/carplay-web-app` directory before running these commands or you will experience errors.
{% endhint %}

Now you have two options. Run as development (do not build), or build and then run. You will get better performance if you build, but if your having issues you can just run it with npm.

{% code title="Run as development" %}

```bash
npm start
```

{% endcode %}

{% code title="Build then run" %}

```bash
npm install -g serve | npm run build | serve -s build
```

{% endcode %}

## < Raw Instructions >

{% code title="Raw Instructions" fullWidth="true" %}

```
Run and Update OS : sudo apt-get update | sudo apt-get upgrade
Install git : sudo apt install git
Install curl : sudo apt install curl
Install node USB drivers : sudo apt install -y libudev-dev
Install nvm (bypass bad node scripts) : curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Open New Terminal and Check For Working NVM : command -v nvm
Install Patched NPM : nvm install v18.17.0
Clone node-CarPlay : git clone https://github.com/rhysmorgan134/node-CarPlay.git
Install node-CarPlay : npm install
Init node-CarPlay : npm i
Change Directories to Example : cd examples/carplay-web-app
Init node-CarPlay-Example : npm i
Start node-CarPlay-Example (start as development, bad optimization): npm start

How to build node-CarPlay (better performance, MAKE SURE YOUR IN THE EXAMPLE FOLDER THE ENTIRE TIME):
Install npm serve : npm install -g serve
Run NPM builder : npm run build
Start build at anytime : serve -s build
```

{% endcode %}


---

# 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://flux-11.gitbook.io/headunit/setting-up-for-carplay/preparing-ubuntu.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.
