0
votes

The source code: https://github.com/tenzan/dmb-vagrant

Trying to make a development environment with:

  1. Host OS: Windows 10
  2. Vagrant - latest version
  3. VirtualBox - latest version
  4. NodeJS/VueJS

Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "bento/ubuntu-18.04"

  config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "private_network", ip: "192.168.0.1"

  config.vm.synced_folder "./code/", "/home/vagrant/code/"
  config.vm.provision "file", source: "./bootstrap.sh", destination: "/home/vagrant/"

  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
  
    # Customize the amount of memory on the VM:
    vb.memory = "1024"
  end

  config.vm.provision :shell, inline: "sudo chmod  +x bootstrap.sh"
  config.vm.provision :shell, path: "bootstrap.sh"
end

bootstrap.sh:

!/usr/bin/env bash

apt-get update
apt install curl -y
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt install build-essential nodejs -y
sudo apt autoremove -y
cd code
sudo npm install
npm run serve

The folder code contains folders

enter image description here

Then I run: vagrant up && vagrant provision

Some of the last lines of the error message:

 default: enoent
    default:  SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/vagrant/code/node_modules/fsevents/node_modules/yallist' -> '/home/vagrant/code/node_modules/fsevents/node_modules/.yallist.DELETE'
    default: npm
    default:
    default: ERR!
    default:
    default: code
    default:  ENOENT
    default: npm
    default:
    default: ERR!
    default:
    default: syscall
    default:  open
    default: npm
    default:
    default: ERR!
    default:
    default: path
    default:  /home/vagrant/code/node_modules/yorkie/node_modules/execa/package.json.457924413
    default: npm
    default:
    default: ERR!
    default:
    default: errno
    default:  -2
    default: npm
    default:
    default: ERR!
    default:
    default: enoent
    default:  ENOENT: no such file or directory, open '/home/vagrant/code/node_modules/yorkie/node_modules/execa/package.json.457924413'
    default: npm
    default:
    default: ERR!
    default:
    default: enoent
    default:  This is related to npm not being able to find a file.
    default: npm
    default:
    default: ERR!
    default:
    default: enoent
    default:
    default: npm
    default:
    default: ERR!
    default:  A complete log of this run can be found in:
    default: npm
    default:
    default: ERR!
    default:      /root/.npm/_logs/2020-02-17T08_32_31_672Z-debug.log
    default:
    default: > [email protected] serve /home/vagrant/code
    default: > vue-cli-service serve
    default: sh: 1:
    default: vue-cli-service: not found
    default: npm
    default:
    default: ERR!
    default:
    default: code
    default:  ELIFECYCLE
    default: npm
    default:
    default: ERR!
    default:
    default: syscall
    default:  spawn
    default: npm
    default:
    default: ERR!
    default:
    default: file
    default:  sh
    default: npm
    default:
    default: ERR!
    default:
    default: errno
    default:  ENOENT
    default: npm
    default:
    default: ERR!
    default:  [email protected] serve: `vue-cli-service serve`
    default: npm
    default:
    default: ERR!
    default:  spawn ENOENT
    default: npm
    default:
    default: ERR!
    default:
    default: npm
    default:
    default: ERR!
    default:  Failed at the [email protected] serve script.
    default: npm
    default:
    default: ERR!
    default:  This is probably not a problem with npm. There is likely additional logging output above.
    default: npm
    default:
    default: ERR!
    default:  A complete log of this run can be found in:
    default: npm
    default:
    default: ERR!
    default:      /root/.npm/_logs/2020-02-17T08_32_32_104Z-debug.log
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
1

1 Answers

0
votes

Have you installed npm in your vagrant?

try sudo apt-get -y install npm before you run npm install