© Bryan Lim and Richard LaFranchi 2019
B. Lim, R. LaFranchiVue on Railshttps://doi.org/10.1007/978-1-4842-5116-4_7

7. Testing, Deployment, and Troubleshooting

Bryan Lim1  and Richard LaFranchi2
(1)
Singapore, Singapore
(2)
Boulder, CO, USA
 

This chapter contains three small chapters in one, namely, Testing, Deployment, and Troubleshooting. They do not aim to be complete guides for these topics but to provide the essentials for those who are starting this journey and how they apply to a Vue on Rails approach.

Testing Approaches

The software testing world is a whole discipline in itself apart from the development world. Large companies have dedicated QA/QC departments to offload the burden from engineers. The theory is that engineers spend the time doing what they do best – engineering. But what if you work on a small team or project? What if you are a one-human shop? You’ll have to make some tradeoffs depending on the type of project you are working on and the consequences that could happen if a severe bug is introduced. Could one of your customers lose money? Is sensitive information at risk if the project is hacked? Is it a software system that could potentially cause human injury? Or even worse – death?

There are tradeoffs for everything, but the main goal in software testing is to catch bugs before they are released, and the best way to do this is to maintain a suite of regression tests so that bugs aren’t introduced after implementing a new feature. We’ll talk about how to do that in a Vue on Rails approach with the idea of keeping it simple and will be geared towards low-consequence projects where your small team may or may not have the time and money to spend on testing. If you work on a high-consequence project, make sure you have the budget for a proper QA/QC cycle before releasing. That being said, a low-consequence project doesn’t mean you have to produce a low-quality product. There is a good balance between development and testing that aligns with the Vue on Rails approach of keeping things with Vue’s simplicity and the conventions of Rails.

TDD – To Drive or Not to Drive?

TDD or test-driven development is a development process that encourages writing tests first before writing the actual code for the software. The idea is to write a test for a feature or a test that reproduces an existing bug in the software, make sure the test fails as expected, then write the code that makes the test pass, and finally refactor code if necessary and make sure the test still passes.

In my experience I have seen many developers and product managers argue about the benefits of TDD. First, stop arguing about it. Every developer and team is different, some do strictly TDD , some do it on occasion, and some not at all. We’ll leave that decision up to your team. I find TDD to be useful in scenarios that are not very straightforward and a solution is not easily attained. The test first approach could help jumpstart the problem-solving process in certain scenarios. TDD is often considered as a way to drive correctness of code from developers’ perspective.

What about RSpec and BDD?

An extension of TDD called behavior-driven development or BDD is a different way of looking at testing from a user’s or stakeholder’s perspective and created in a way that all parties involved in a project can understand. RSpec is a testing framework inspired by BDD that is widely adopted in the Ruby on Rails community. BDD and the decision to use RSpec should up to your team as well. If Rails testing that is supported out of the box is sufficient for the project, then there is not much need to use RSpec.

General Testing Guidelines

Regardless of the testing styles you choose to adopt, here is a list of general guidelines that we recommend for testing:
  • Unit test methods that aren’t trivial in the business model.

  • Write at least one integration test for get actions show/index.

  • Write two tests for create/update actions. One for success/and one that fails on validation errors also known as the happy path vs. dark path.

  • Write system tests/e2e tests for core features.

  • If bugs occur, write a test integration/or unit to reproduce it and fix the bug.

  • System tests will catch a lot of bugs on the Vue side, but it may also help to write unit tests for Vue components.

  • UI/browser tests can be fragile so don’t overdo it. More time will be spent fixing fragile tests than actual development.

System Tests

System tests are important in environments that integrate Vue and Rails because it provides an end-to-end solution to testing the integration of the two technologies. The latest version of Rails supports system tests out of the box. System tests are essentially a wrapper around Capybara for writing clean and simple tests that interact directly with the browser using helper methods such as click_on, fill_in, and assert_selector. Before system tests were integrated into the Rails framework, configuration was necessary for this to work, and JavaScript was not supported out of the box.

We will demonstrate an example for testing our two-player Tic Tac Toe game that we built in Chapter 5. This is a unique situation because we’ll need to have multiple browser sessions to be able to test a game from start to end. Luckily Capybara has a use_session method just for this purpose. The test starts a new game in the main browser session and joins as X. In the other session, the other player joins the game created and plays as O. A series of pieces are placed and we swap between sessions and play until the game is over.
require "application_system_test_case"
class MultiSessionsTest < ApplicationSystemTestCase
  test "visiting the index" do
    visit root_path
    click_on "New Game"
    click_on "Play as X"
    assert_text "You are Playing as X"
    Capybara.using_session :o do
      visit root_path
      click_on "Go to Board", match: :first
      click_on "Play as O"
      assert_text "You are Playing as O"
    end
    x_positions = [0, 4, 8]
    o_positions = [1, 3]
    while x_positions.length > 0
      x_pos = x_positions.shift
      play(x_pos)
      assert_piece(x_pos, :X)
      if o_positions.length > 0
        o_pos = o_positions.shift
        Capybara.using_session :o do
          assert_piece(x_pos, :X)
          play(o_pos)
          assert_piece(o_pos, :O)
        end
        assert_piece(o_pos, :O)
      end
    end
    assert_text "You Win"
    Capybara.using_session :o do
      assert_text "You Lose"
    end
  end
end

So, the preceding code covers a happy path of a game from start to end with one winner and one loser. We’ve defined a couple helper methods – play and assert_piece. The play method clicks on the appropriate board position and assert_piece checks that the appropriate piece has been played. For this to work, we also need to define an id attribute on the related SVG element such as “X5” denoting that an X is visible in the fifth board index. Helper methods can be defined in the ApplicationSystemTestCase class since all our test cases for system tests extend from that class.

What about other scenarios such as a tied game? Or a different board configuration? We could create a few helper methods to cover these scenarios in a system test, but it is not the best approach. Each system test adds a bit of overhead to the time it takes to run your test suite. These scenarios would be better covered in a typical Rails unit test. If there is a UI scenario that needs to be covered, we could also use Jest and Vue test utilities to create a unit for a particular Vue component. This leads us into the discussion of such testing tools and frameworks that we can use for unit testing Vue components.

Vue Test Utilities and Jest

When unit testing Vue components, it is easy to get carried away with testing lots of edge cases just like it can be with system tests. So, it is important to think about the important pieces of a component. Take the Board component in the Tic Tac Toe game, for example. It would be unrealistic to test every possible board configuration, and we aren’t necessarily even interested in that since a game object is passed down as a prop. The important part of the component is testing that when a player clicks on a certain board position, it results in the appropriate action being called; in this case, it is the Vuex action for games_players/UPDATE. The vue-test-utils documentation has some good examples on testing Vuex action, so we will follow those guidelines for testing this scenario.

Documentation

Vue test utilities and Jest have great documentation and can be found respectively at https://vue-test-utils.vuejs.org and https://jestjs.io

Generating a Vue Unit Test

The vuejs gem includes the option to generate a test when you generate a component. The following commands will check if Vue testing is setup for your Rails project and generate a component that includes a test file.
rails vue:test
rails generate vue something --test
This will generate a scaffold of a very simple test along with the component that is generated. The test is generated at the path app/javascript/test/something.test.js. The following test code is generated.
import { shallowMount } from '@vue/test-utils'
import App from '@/some.vue'
describe('some.vue', () => {
  it('render hello some', () => {
    const message = "Hello some!"
    const wrapper = shallowMount(App)
    expect(wrapper.find('#some').text()).toBe(message)
  })
})
To run all your *.test.js files that live in app/javascript/, simply run the following command:
yarn test

This runs any test that matches the *.test.js pattern with app/javascript.

Testing the Tic Tac Toe Board Component

The following example uses the Jest mockImplementation() method, which returns a promise. We can create a few unit tests that cover the following:
  • A simple test that ensures an SVG element is rendered

  • A test that ensures the games_players/update Vuex action is called for an empty board position

  • A test for checking that the games_player/update Vuex action is not called when a position has already been played

A lot of examples take advantage of the great documentation about testing Vuex in the official vue-test-utils documentation. The examples trigger the position click action by finding the first <rect> element in the Board component .
import { shallowMount, createLocalVue } from '@vue/test-utils'
import Board from './board.vue'
import Vuex from 'vuex'
const localVue = createLocalVue()
localVue.use(Vuex)
describe('Board', () => {
  let actions
  let store
  beforeEach(() => {
    actions = {
      update: jest.fn().mockImplementation(cb => cb)
    }
    store = new Vuex.Store({
      state: {},
      modules: {
        games_players: {
          namespaced: true,
          state: {
            all: [],
            current: null,
            error: null
          },
          actions
        }
      }
    })
  })
  test('renders an svg', () => {
    const wrapper = shallowMount(Board, { store, localVue })
    expect(wrapper.contains('svg'))
  })
  test('calls games_players update action', () => {
    const wrapper = shallowMount(Board, { store, localVue })
    wrapper.setProps({
      myPiece: 'X',
      width: 400,
      game: {
        id: 1,
        board: [",'O','X',",",",",","],
        games_players: [
          {
            id: 1,
            game_id: 1,
            player_id: 1,
            piece: 'X'
          },
          {
            id: 2,
            game_id: 1,
            player_id: 2,
            piece: 'O'
          }
        ]
      }
    })
    wrapper.find('rect').trigger('click')
    expect(actions.update).toHaveBeenCalled()
  })
  test('does not call games_players update action for existing piece', () => {
    const wrapper = shallowMount(Board, { store, localVue })
    wrapper.setProps({
      myPiece: 'X',
      width: 400,
      game: {
        id: 1,
        board: ['X','O',",",",",",","],
        games_players: [
          {
            id: 1,
            game_id: 1,
            player_id: 1,
            piece: 'X'
          },
          {
            id: 2,
            game_id: 1,
            player_id: 2,
            piece: 'O'
          }
        ]
      }
    })
    wrapper.find('rect').trigger('click')
    expect(actions.update).not.toHaveBeenCalled()
  })
})

Heroku – The Ninja Deployment

This simple command has been a developer’s dream come true.
git push heroku master

For most small- to medium-sized projects, we recommend Heroku as a platform for publishing applications, especially if you don’t have the resources for a dedicated DevOps team or system admin. The Ninja command covers the basics, and Heroku now supports Webpacker and will build our necessary Vue component assets along with any assets handled by sprockets. You’ll still need to think about how to handle migrations and will need to think about Redis addons to support background jobs and Action Cable if needed by your application.

Heroku vs. Virtual Private Server

There are plenty of cloud providers that offer virtual private servers (VPS) such as Digital Ocean, Amazon Web Services, Google Cloud, and many other providers. A VPS is a server that runs in a virtual environment on shared physical hardware. Hardware is maintained by the cloud provider, so swapping out bad disks, CPUs, etc. VPS providers often give you the choice of which operating system you would like to run with different flavors of Linux such as CentOS or Ubuntu. This may be a viable option for developers who also like to get into the nitty gritty of system administration or have more resources to support maintenance and monitoring of the servers. Be sure to weigh in on all the tradeoffs of this approach. We have listed the advantages and disadvantages of each option for you to evaluate.

Heroku advantages:
  • Ninja deployment in one command

  • Third-party addon support such as Redis support

  • Automated SSL certificates for hobby level

  • No time consumed by system monitoring and administration

Heroku disadvantages:
  • Expensive for large-scale projects (some may argue that cost is offset by not needing some large ops team)

  • Less control over the environment

VPS advantages:
  • More control of the environment. So control over networking and firewalls if you need a private environment.

  • Inexpensive (as little as $5/month for basic VPS).

  • Learning how to setup NGINX/Apache along with a production Ruby environment using Passenger or Unicorn is a good learning experience and a very valuable skill.

  • Learning how to setup and administer a database such as Postgres or MySQL is also a valuable skill.

VPS disadvantages:
  • Setting up a Rails-ready production environment takes time.

  • Deployments can be automated using tools such as Capistrano, but configuring Capistrano is often non-trivial.

  • Overhead of maintaining and monitoring a server such as monitoring memory, CPU, and disk usage. Some cloud providers offer automatic scaling, but other service providers may not.

Continuous Integration and Deployment

Whether we are using Heroku or a VPS, we can take advantage of various continuous integration services such as Travis CI to combine and automate our test, build, and deploy process. This will come in handy especially if we want our application to support different browsers. If you are developing in Chrome on a Mac, how do you know if our Vue components are supported on Firefox on a PC? A great service for this is BrowserStack and provides the ability to test various browsers on multiple operating systems. We can ensure our testing phase passes before the application is deployed to production. Also, if we need a finer grained release management, then we can choose only to deploy when a release is tagged in our git repo or under other conditions. We will demonstrate how to set up Travis CI to include a custom test and deploy process which integrates with BrowserStack and Heroku. To get started you’ll want to sign up for accounts at travis-ci.org and browserstack.com.

Travis CI

Travis CI is a popular continuous integration tool that easily integrates with GitHub and other tools such as BrowserStack. Travis CI has some great documentation on getting started, so we won’t go into too much detail, but will show a .travis.yml configuration file which we can use to perform the following CI process in three stages:
  • Testing stage which runs our unit and integration tests including our Vue unit tests

  • A staging deployment phase which gets our latest code up to our Heroku staging environment

  • A BrowserStack phase which runs our system tests against our Heroku staging URL

The following is an example Travis CI yaml configuration file.
language: ruby
rvm:
- 2.5.5
cache:
  - bundler
  - yarn
env:
  secure: # use travis encrypt
before_script: bin/yarn
jobs:
  include:
  - stage: test
    name: Rails Unit/Integration Tests
    script: bin/rails test
  - name: Jest Unit Tests
    script: bin/yarn test
  - stage: deploy staging
    deploy:
      provider: heroku
      app: vueonrails-ci-staging
      run: bin/rails db:migrate
      strategy: git
      api_key:
        secure: # … use travis encrypt
  - stage: test staging
    name: firefox
    script: TASK_ID=0 bin/rails test:system
  - name: chrome
    script: TASK_ID=1 bin/rails test:system
  - name: safari
    script: TASK_ID=2 bin/rails test:system
  - name: internet explorer
    script: TASK_ID=3 bin/rails test:system

This configuration allows us to perform multiple tasks in parallel within the three stages we mentioned. Running our Rails unit and integration tests along with the Heroku deployment are straightforward as long as we encrypt and add our api key for Heroku using the travis encrypt command. Using BrowserStack to run our system tests against multiple browsers is not as trivial. This stage is broken up into four tasks, one for each browser. Next, we’ll discuss how to configure BrowserStack to work properly.

BrowserStack

BrowserStack has the capability to run its tests against our local test server, but ideally, we want to run the tests against our staging environment on Heroku to test an environment as close as possible to production. System tests use Capybara under the hood, so we can simply set our app host for Capybara in our test/test_helper.rb file.
Capybara.app_host = 'https://staging-app.herokuapp.com:443'
You’ll notice that our Travis CI configuration for the BrowserStack stage includes a TASK_ID variable in the command. Our code for setting up BrowserStack uses this value to determine which browser to run against. We can define a config/browserstack.yml file which includes this configuration.
server: "hub-cloud.browserstack.com"
common_caps:
  "browserstack.debug": true
browser_caps:
  -
    browser: firefox
  -
    browser: chrome
  -
    browser: safari
  -
    browser: internet explorer
We can now setup a custom Capybara driver that uses the TASK_ID to select the appropriate browser to run against.
TASK_ID = (ENV['TASK_ID'] || 0).to_i
CONFIG = YAML.load(File.read(Rails.root.join("config", "browserstack.yml")))
CONFIG['user'] = ENV['BROWSERSTACK_USERNAME'] || CONFIG['user']
CONFIG['key'] = ENV['BROWSERSTACK_ACCESS_KEY'] || CONFIG['key']
Capybara.register_driver :browserstack do |app|
  Capybara.app_host = 'https://vueonrails-ci-staging.herokuapp.com:443'
  @caps = CONFIG['common_caps'].merge(CONFIG['browser_caps'][TASK_ID])
  Capybara::Selenium::Driver.new(app,
    :browser => :remote,
    :url => "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub",
    :desired_capabilities => @caps
  )
end
You’ll notice that the code uses BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables. We can encrypt these values to include in our travis config file using the travis cli, for example.
travis encrypt BROWSERSTACK_USERNAME=...
Finally, we just need to update our test/application_system_test_case.rb to inform Rails to use the Browserstack server by using the driven_by method.
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
  driven_by :browserstack
end
And that about wraps things up for using Travis CI to automate a lot of tasks that we often see in development environment that moves a quick pace and quick iterations. Let’s see how our tests performed in the Travis CI dashboard (see Figure 7-1)
../images/465247_1_En_7_Chapter/465247_1_En_7_Fig1_HTML.jpg
Figure 7-1

Travis CI results dashboard

DOH! ... always causing problems IE. Good thing we didn’t deploy it to production. Note that our Travis CI configuration doesn’t include a deployment process to production, but this can be easily done by adding another deployment stage once all previous stages have completed in a similar manner to our staging deployment. Following a good process for getting your app into production isn’t always clear especially for small development teams that also need to do their own DevOps, so we wanted to make the testing and deployment phase of a project straightforward and hope you appreciate our approach which aligns with our philosophy of simplicity.

Troubleshooting Common Issues of Vue on Rails

In this section, we explore some common and sometimes thorny issues of Vue on Rails projects that you may stumble upon. If you need further help, you could list it on stackoverflow.com as Vue on Rails or you could always list an issue at the Webpacker project ( http://github.com/rails/Webpacker ). Each of the following issues is covered in this section.
  1. 1.

    In a Vue on Rails project with Webpacker, can I import the Vue on Rails project into Vue UI?

     
  2. 2.

    In a Vue on Rails project with Webpacker, how do I change the compile path from app/javascript/packs to something else?

     
  3. 3.

    In a Vue on Rails project with Webpacker, how do I use embedded Ruby (Erb) inside your Webpacker project?

     
  4. 4.

    How do I fix the error “Cannot find module <name_of_module>”?

     
  5. 5.

    How do I solve an error that says “TypeError: undefined is not an object (evaluating ‘options.components’)”?

     
  6. 6.

    In a Vue on Rails project with Webpacker, how do I disable fingerprinting to create Vue.js widget component?

     
  7. 7.

    How do I solve the following Vue error: “Did you register the component correctly? For recursive components, make sure to provide the name option.”

     
  8. 8.

    Is there a way to use npm instead of yarn as the default package manager?

     
  9. 9.

    For Vue on Rails project with Webpacker, how do I manage Node and Rails environments?

     
  10. 10.

    For Vue on Rails projects with Webpacker, is there a way to bypass the IE 11 issues on Windows?

     
  11. 11.

    For Vue on Rails projects with Webpacker, shouldn’t package X be in the dependencies instead of devDependencies?

     
  12. 12.

    How do I solve this Heroku error: “No default language could be detected for this app”?

     
  13. 13.

    How do I solve this Heroku error: “App not compatible with buildpack”?

     

This chapter assumes your Vue on Rails uses Webpacker as the default Webpack manager.

1. In a Vue on Rails project with Webpacker, can I import the Vue on Rails project into Vue UI?

Vue UI is a web application that you can run to manage Vue projects and is a feature of vue-cli. To make Vue on Rails compatible with Vue UI, you will need to add the @vue/cli-service package into devdependencies of package.json:
yarn add @vue/cli-service --dev

With the Vue UI installed, you can import the Vue on Rails project by clicking Import > Go to the Vue on Rails project and click Import this project.

2. In a Vue on Rails project with Webpacker, how do I change the compile path from app/javascript/packs to something else?

You may wish to use a different directory to store your Vue components or javascript. You can change the directory name or the path at Webpacker.yml.

3. In a Vue on Rails project with Webpacker, how do I use embedded Ruby (Erb) inside your Webpacker project?

Sometimes, you want to use erb inside your Vue component. To do so, please install the erb dependencies into your Webpacker setup:
rails webpacker:install:erb

4. How do I fix the error “Cannot find module <name_of_module>”?

This error is telling you that Webpack cannot find the <name_of_module> module. Hence, we need to add it via yarn. Run the following command to fix it:
yarn add <name_of_module>

5. How do I solve an error that says “TypeError: undefined is not an object (evaluating ‘options.components’)”?

This error is telling you that Webpack cannot find the <name_of_module> module. Hence, we need to add it via yarn. Run the following command to fix it:
yarn add <name_of_module>

6. In a Vue on Rails project with Webpacker, how do I disable fingerprinting to create Vue.js widget component?

This answer is written by Ross Kaffenberger, an active contributor of Webpacker project on the Webpacker project. The following Webpack plugin helps to produce non-digest assets that do not contain fingerprinting. ( https://github.com/rails/webpacker/issues/1310#issuecomment-369721304 )
// Custom Webpack plugin
// Emits assets with hashed filenames as non-digest filenames as well
//
// Adding to end of plugins list ensures that all previously emitted hashed
// assets will be registered prior to executing the NonDigestAssetsPlugin.
function NonDigestAssetsPlugin() {}
const CHUNKHASH_REGEX = /(-[a-z0-9]{20}.{1}){1}/;
NonDigestAssetsPlugin.prototype.apply = function(compiler) {
  compiler.plugin('emit', function(compilation, callback) {
    // Explore each compiled asset in build output:
Object.entries(compilation.assets).forEach(function([filename, asset]) {
      if (!CHUNKHASH_REGEX.test(filename)) return;
      // only for filenames matching CHUNKHASH_REGEX
      const nonDigestFilename = filename.replace(CHUNKHASH_REGEX, '.');
      compilation.assets[nonDigestFilename] = asset;
    });
    callback();
  });
};
module.exports = NonDigestAssetsPlugin;

7. How do I solve the following Vue error: “Did you register the component correctly? For recursive components, make sure to provide the name option.”

This error is pointing to two questions. First, did you register the component correctly?
components: {
      'i-tabs' : Tabs,
      'i-tab-pane': Tabpane
    }
Second, did you provide the name option in your recursive component?
name: 'Tabpane'

8. Is there a way to use npm instead of yarn as the default package manager?

For new Rails projects, we can add a flag to the command to bypass yarn and use npm.
rails new npm_app --webpack --skip-yarn

Now you can install npm packages using the npm install command.

9. For Vue on Rails project with Webpacker, how do I manage Node and Rails environments?

Rails uses RAILS_ENV and Node traditionally uses NODE_ENV environment variables to manage whether an app is in development or production. A pull request was merged to ensure these two variables are reconciled.

See https://github.com/rails/webpacker/pull/1511

10. For Vue on Rails projects with Webpacker, is there a way to bypass the IE 11 issues on Windows?

IE 11 issues may be caused the UgligyJs plugin not using a downgraded version of ECMA. Try configuring with the following code.
const environment = require('./environment')
environment.plugins.get("UglifyJs").options.uglifyOptions.ecma = 5
module.exports = environment.toWebpackConfig()
module.exports = NonDigestAssetsPlugin;

11. For Vue on Rails projects with Webpacker, shouldn’t package X be in the dependencies instead of devDependencies?

The answer lies in how Webpacker works. Webpacker produces JavaScript code called packs that can be embedded into Rails view via the javascript_pack_tag. This requires certain development dependencies to be in the dependencies of package.json.

For further discussion or research, please visit the following links:

https://github.com/rails/webpacker/issues/1212

https://github.com/rails/webpacker/issues/1178

12. How do I solve this Heroku error: “No default language could be detected for this app”?

If you see the following error message from Heroku console, you need to install the relevant buildpack.
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     No default language could be detected for this app.
remote:            HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:            See https://devcenter.heroku.com/articles/buildpacks
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !      Push rejected to page-specific-vue-turbolinks.
remote:
To https://git.heroku.com/page-specific-vue-turbolinks.git
 ! [remote rejected]   master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/page-specific-vue-turbolinks.git'
Run the following commands to properly configure the buildpacks for the project.
heroku buildpacks:clear
heroku buildpacks:set heroku/nodejs
heroku buildpacks:add heroku/ruby

See https://github.com/rails/webpacker/issues/739#issuecomment-327546884

13. How do I solve this Heroku error: “App not compatible with buildpack”?

When deploying to Heroku, you may see the following error in the output. This means that a package.json file was not found in the app.
Counting objects: 16871, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13035/13035), done.
Writing objects: 100% (16871/16871), 17.27 MiB | 1.19 MiB/s, done.
Total 16871 (delta 2944), reused 16834 (delta 2933)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz
remote:        Node.js: package.json not found in application root
remote:
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !      Push rejected to page-specific-vue-turbolinks.
remote:
To https://git.heroku.com/page-specific-vue-turbolinks.git
 ! [remote rejected]   master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/page-specific-vue-turbolinks.git'
To solve this problem, make sure that Webpacker is installed and a package.json file exists and also that the necessary buildpacks are installed on Heroku using the following commands.
rails webpacker:install
heroku buildpacks:add heroku/nodejs
heroku buildpacks:add heroku/ruby

Wrap-up and the Final Step

This concludes the testing, deployment, and troubleshooting chapter of our book. We’ve shown you how to go from the development phase to a well-tested and deployed production quality application using various testing tools and continuous integration methods. We move on to the final chapter to conclude our book and leave you with some words of wisdom.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.179.119