Troubleshooting: Resolving the Relative Module Not Found Error in npm run serve Command

I'm currently working on a blockchain project with Vuejs as the frontend. After installing all dependencies using "npm install" command, I attempted to run the development server with "npm run serve" in the /appvue root folder. However, I encountered a compilation error stating:

The relative module could not be found:

  • ../../build/contracts/SupplyChain.json in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&

Being new to VueJs, I suspect that the Supplychain.json file is missing, even though it should be present in the attached project structure.

https://github.com/kafukoM/project_3_Dapp_Supply_Chain

Answer №1

In order to fix the issue, you must update the import statement in line 209 of your App.vue file. Here is how it should be modified:

import supplyChainArtifact from '../../../build/contracts/SupplyChain.json'

to

import supplyChainArtifact from '../../app/src/SupplyChain.json'

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

Ensure that the date is valid in the 'mm-dd-yyyy' or 'mm/dd/yyyy' formats by utilizing JQuery Validate

How can I validate dates in both 'mm-dd-yyyy' and 'mm/dd/yyyy' formats using JQuery Validate? I attempted to write code that validates one format, but it does not work for both 'mm-dd-yyyy' and 'mm/dd/yyyy' formats. ...

Ways to ensure a particular promise is executed only once in Angular 1.5 despite multiple calls to the onInit hook

When the onInit function is called, an API request is made. vm.$onInit = function() { var callInProgress = false; var resultsLoaded = false; var url = '/api/times/cst'; if(callInProgress === false && ...

Updating an array element in Mongoose, the MongoDB ORM

I am currently in the process of making changes to a MongoDb collection that contains an array of documents called items. To achieve this, I am utilizing the express and mongoose frameworks. This is how my schema is structured: const mongoose = require(" ...

JavaScript - Adjusting Size of Images in Slideshow

My current project involves creating a slideshow in JavaScript where I only want to display half of the images. However, I have encountered an issue with some images having a width and height equal to 0 specifically in Chrome and Opera browsers. What could ...

The Azure-hosted Node.js web application is not displaying any content

I followed a tutorial on deploying my Vue project on Azure, but I encountered an issue. Even though the main.ts file exists in the app service, the hosted URL is showing an error and can't find the main.ts file. Here is a screenshot of the error: Erro ...

Updating form validation: relocating error messages

When using a jQuery form validation script, an "OK!" message is typically displayed below the input field when the input is correct. However, I would like to customize this behavior and have the "OK!" message appear on the right side of the field instead ( ...

The specified width and height for a div containing images are not being accepted by Firefox

I am facing an issue with the CSS for a div that contains images and is not displaying any width: .wide{ width:5000px; height:100%; overflow: hidden; z-index: 1; display:none; } Here is the HTML code for the div: <div class="wide ...

When it comes to assigning a background to a div using jQuery and JSON

I have been experimenting with creating a database using only JSON and surprisingly, it worked once I added a "js/" in the URL. However, my current issue lies with CSS. Let me elaborate. Here is the JSON data: [ { "title":"Facebook", ...

Naming a JSON object twice

As a newcomer to node.js, I find myself struggling with understanding the process. Can someone please guide me on where I might be going wrong? This is how I create a new Product exports.postAddProduct = (req, res, next) => { const product = new Produ ...

Attempting to transform a class component into a functional component

As I attempt to convert a class component into a functional component, I encounter unexpected issues. The original class component dynamically renders rows of selects based on user input, and when a certain option is selected in the first row, an additiona ...

Retrieving Data from AngularJS Service

Struggling to populate data from a service into my view. Here is how I have defined the service: app.factory('nukeService', function($rootScope, $http) { var nukeService = {}; nukeService.nuke = {}; //Retrieves list of nuclear weap ...

How can jQuery be employed to locate the position of an element within its group of siblings with a particular CSS class?

Here is an example of HTML code: <div class="component"> <div class="component"> <div class="component"> </div> </div> <div class="component"> <div class="somethingelse"> ...

Transferring data with Node express in and out of applications

As I embark on my first Node project, a friend advised me to create a .js file for common and frequently used functions. For instance, when performing operations with Mongoose such as querying data or updating it, having a separate .js file for these task ...

Step by step guide on showcasing live server information obtained from the user-end through AJAX technique in a Javascript Pie Chart, within an ASP.NET html template

I have successfully managed to transfer data from the Client Side (C# Back End) to the Server Side (Javascript HTML in aspx) using AJAX. The example I found online demonstrated data display inside a div, but I'm unsure how to dynamically display my ow ...

How to Make a Fixed Sidebar with Visual Composer on Your WordPress Site

I'm struggling to create a sticky sidebar on my WordPress site because Visual Composer doesn't allow me to add more IDs and Classes to the divs. I've tried using the Sticky Sidebar plugin from GitHub, which can be found here: The script has ...

Change the name of "rows" in the findAndCountAll method of Sequelize

Is there a way to change the key name for result.row when utilizing findAndCountAll in Sequelize? For pagination purposes, I am implementing findAndCountAll. The data structure I receive is as follows: { "count": 8, "rows": [ { ...

Extracting the value of an input field using jQuery

Is there a way to dynamically change the perPage value in this jQuery code based on user input from an input field? I need to create pagination for a table and allow the user to control the number of rows displayed per page. $(document).ready(function(){ ...

Having trouble properly refreshing Bootstrap scrollspy that is spying on the <body> element

I've been looking at a post on Bootstrap's scrollspy component (found here). In my code, I initialize a new scrollspy to track the body element using: $("body").scrollspy({ offset: 25 }); As my code progresses, I make AJAX requests that add or ...

The commitment remained unfulfilled following a validation error

I have a login form that uses the promise object for authentication. Everything works smoothly except when the form validation is triggered. Below is my HTML code: <form id="signin" class="signinform" autocomplete="off"> <span ng-show="err ...

The text box's word limiter is malfunctioning when writing code on a child page of the master

Encountering an unexpected problem that I never thought would happen. I wrote a word limiter code for a text box on a single page and it was working perfectly fine. The word limiter worked and the remaining words were displayed by a label named "remaining6 ...