Utilize npm to construct a Vue application and execute it on a Raspberry Pi device

My roommate and I are currently working on a Vue app project together, and we're aiming to deploy it on our Raspberry Pi. We're wondering if there's a way to npm build the final app on our PC and simply start the server on the Pi without having to build the app directly on the Raspberry. If this is possible, could you please guide us on how to initiate the app on the Pi?

Your assistance would be greatly appreciated!

Answer №1

Definitely doable. Develop your Vue app on your computer (referred to as the development environment) and then host it on your raspberry pi (production environment). There are various methods to accomplish this, but essentially you just need to:

  1. Set up your raspberry pi as usual by installing the preferred OS
  2. Access the pi via SSH from your PC
  3. Install a web server such as Nginx or Apache for hosting the Vue app
  4. You can install Node and Git on the webserver using SSH. Then proceed to clone the app repository directly into the appropriate folder. With Node setup on the server, you can execute npm commands and build the Vue site with npm run build. Alternatively, you can transfer your build/dist folder to the server, although additional configuration may be required.
  5. Obtain a domain name and link it to the IP address of your raspberry pi ( is recommended)

Some helpful tutorials to refer to include:

  1. Setting up SSH on a raspberry pi
  2. Configuring Nginx or Apache on a raspberry pi
  3. Deploying a Vue app to a webserver (explore both Nginx and Apache). YouTube has useful videos on this topic
  4. Linking a domain name to your raspberry pi website

Note: It's crucial to bear in mind that exposing your webserver to the internet through your home network could potentially jeopardize your router security, allowing unauthorized access to your devices. Consider setting up a firewall to safeguard against this threat. Research this aspect further for more information.

Check out these valuable resources:

https://medium.com/@thesabareesh/host-your-own-website-on-a-raspberry-pi-3-e3c8fdb90f90

Answer №2

After building a vanilla Vue project, you will find a dist directory filled with static files.

To share these files over the internet, consider using a static file server like Nginx or Apache. Apache often comes pre-installed in Raspberry Pi OS and many other distributions.

If you need help setting up Apache, check out this guide. Additionally, the Vue documentation includes tips for deployment.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

AngularJS ui-select not responding correctly to selected items

Currently, I am utilizing the ui-select module within AngularJS. <ui-select ng-model="tipData.category" search-enabled="false" name="category" required="required" class="orange-site-color-select custom-select"> <ui-select-match><span clas ...

Creating a custom function that targets a specific element

When working with JavaScript, you may often encounter functions written in the form of document.getElementById("element").someFunction(); or $("element").someFunction(); rather than the traditional someFunction($("element"));. This is similar to a function ...

Select a random character from a string using JavaScript

This question sets itself apart from Removing random letters from a string as it focuses on selecting a random letter from a string in JavaScript without removing any characters. The goal is to implement a code that picks random letters from a string in J ...

Retrieve text from a dropdown menu while excluding any numerical values with the help of jQuery

I am currently implementing a Bootstrap dropdown menu along with jQuery to update the default <span class="selected">All</span> with the text of the selected item by the user. However, my objective is to display only the text of the selected it ...

Is there a way to resolve a conflicting peer dependency issue without having to execute the npm install command?

I'm facing a challenge with an older project that I built using create-react-app. The issue lies in a conflicting peer dependency related to eslint, as outlined below alongside the content of my package.json file. Simply running npm install doesn&apos ...

Tips for efficiently saving data using await in Mongoose

Currently, the code above is functional, but I am interested in utilizing only async/await for better readability. So, my query is: How can I convert cat.save().then(() => console.log('Saved in db')); to utilize await instead? The purpose of ...

Deactivated the UpdateProgress functionality for the entire webpage

After exploring various options, I came across this solution: Is there a way to disable UpdateProgress for certain async postbacks? However, implementing this solution seems to prevent my controls from loading altogether! In my master page, there is an U ...

Adding an existing element to the DOM using Javascript/jQuery

I am facing an issue in my DOM where I have an element with two children, a div block and a button. My goal is to add a new copy of the same div block to the parentNode whenever the button is clicked. Currently, I am using the following code in the button ...

Determine if a specific string is present in any of the values within an array by utilizing

A scenario: I have a cookie that has been split into an array: var treats = document.cookie.split(';'); [dogs=bla, cats=sdfgh, cabbages=kjhgfdfg] If I aim to locate the index of 'cats=sdfgh', I can utilize treats.indexOf('cats= ...

implement a dropdown feature for a vertical menu with the help of Jquery

Struggling to implement a dropdown feature on a vertical navigation using Jquery. The HTML includes a nav section with 1st level list items and nested li's for second level menu items. On clicking the 1st level li, the intention is to toggle SHOW/HID ...

Utilize Bootstrap button dropdown to automatically assign a selected value to a list item

I have a form with a select box that transforms into a bootstrap button after the page loads. However, I am unable to set the selected value for the converted bootstrap button drop-down li. <button type="button" class="btn dropdown-toggle btn-default" ...

Discovering the clicked element using JavaScript: A complete guide

Let me start by saying that I have come across similar posts about tracking event listeners, but in my specific case, I am struggling to figure it out. While I am familiar with the event.target property, I just can't seem to make it work. Here is a s ...

Error: FileReader is not defined in Node.js (Nest.js) environment

I am working on converting my image to base64 using a custom function. However, when I try to execute the code, I encounter an error message stating ReferenceError: FileReader is not defined. This error has left me puzzled and unsure of its cause. Below i ...

Using PHP script to retrieve MySQL table values and dynamically update a live graph in a Javascript function

I've been researching similar issues for quite some time now, but to no avail. Currently, I'm utilizing Highcharts to update a graph every 3 seconds with the latest entry from a specific MySQL table. I am referring to the example Javascript code ...

Creating a two-dimensional perspective in Three.js

I am new to utilizing three.js and I am currently attempting to create a 2D visualization using these 3D tools for layered sprites. I am looking for guidance on the arguments for PerspectiveCamera() and camera.position.set(). I have received some helpful h ...

"Handling Errors in JavaScript when a Button Click Event Triggers a

There are 2 buttons intended for "Add to Favorites" and "Remove from Other Favorites". Here is the code snippet: <button type="submit" class="btn btn-warning btn-xs" id="FavoriButonex" data-id="<?php echo $sorid ?>"> <i class="fa fa-hea ...

While attempting to use JavaScript and AJAX to read a JSON object, I encountered an issue caused by the CORS

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Docu ...

Transitioning to a personal NPM repository: effectively reinstalling packages with consistent versions

After setting up a private NPM registry (proxy), I encountered an issue where all my project packages from package-lock.json were still being installed from the public registry instead of the private one. Despite trying to clear or delete the package-lock. ...

Altering Image Order Across Various Slides

I have customized a parallax website template that is divided into various sections and slides. I want to incorporate a fixed image sequence on each slide that animates based on the scroll position. With 91 images in the animation sequence, it moves quickl ...

Adjusting the Stripe Button to Utilize a Unique Button Class

I have a stripe button on my website and I want to add my custom class to it. I discovered that manually creating the CSS for it can work, but I prefer to maintain consistency across all buttons on my site by using my custom class. No matter what I attemp ...