Stalled progress during Docker build while running npm run build

I encountered an issue while trying to build a docker image, where the process got stuck at the "npm run build" step. Even though the message indicated that the build was successful, it failed to proceed further.

My Dockerfile uses node:16.13.1 as the base Image

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json ./
COPY .npmrc ./
RUN npm install node-sass@latest
RUN npm install <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0f6c607d6a22657c4f3d213a2138">[email protected]</a>
RUN npm install
COPY . /usr/src/app
# build web app
RUN npm run build
EXPOSE 8080
RUN chmod +x /usr/src/app/setup.sh
CMD ["/usr/src/app/setup.sh"]

The process halts after the specified step,https://i.stack.imgur.com/oZCZo.png

This is the content of the Package.json file

{
  "name": "full-kyc",
  "version": "0.1.0",
  ...
}

Answer №1

Encountered the same issue myself. The fix for me was to boost the resources allocated to the docker engine.

I'm working on a MacBook Pro with an Intel 6-core i7 processor and 16GB of RAM, running Colima as my docker engine.

As per the Colima documentation, the default VM setup includes 2 CPUs, 2GiB of memory, and 60GiB of storage. To improve performance, I adjusted these settings using the Colima CLI:

colima start --cpu 4 --memory 10 --disk 80

Before making these changes, the docker build process would hang indefinitely after executing the RUN npm run build command for over 3200 seconds. After enhancing the cpu/memory allocation in Colima, that particular step completed successfully in just 95 seconds.

Answer №2

modify

RUN npm run build

into

CMD ["npm", "run", "build"]

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

Troubleshooting Node.js: Fixing the "Error: ENOENT - File or directory not found" issue

Currently, I have successfully set up a Node.js web application on my production server. Now, I am trying to replicate the same setup on my development server. Node.js, NPM, and MongoDB are all installed on my development server just like in production. H ...

What is the process of packaging CSS alongside a component into an npm module?

As I work on creating a React component library that can be downloaded via npm, I am curious if there is a way to include the styles in the package without requiring the end user to import them separately. Is there a specific method for bundling the styl ...

Leveraging a package.json variable within an npm script

While utilizing npm run to compile a JavaScript file with browserify, I have encountered an issue. Prior to the compilation process, I intend for it to generate a folder within my build directory that corresponds to the version specified in the package.jso ...

Welcome to the JavaScript NodeJs Open Library!

I am trying to open multiple images simultaneously in the default Windows Photo Viewer that I have stored in my folder using the npm open library: let files = ['Dog.gif', 'Cat.jpeg']; for(let i=0; i<files.length; i++){ open(`${file ...

The npx create-react-app command fails to create a React app

Attempting to generate a new React application using the command npx create-react-app myapp on my computer is proving unsuccessful. Here's what I encountered: When running the command D:\AED>npx create-react-app aed, it took 52.503 seconds to in ...

Steps to add font-awesome in Visual Studio 2017 for ASP.NET Core v2 installation

I am working on a project using ASP.NET Core v2 and I want to incorporate font-awesome into my webpage. I've tried multiple methods, such as installing Bower from NPM, installing font-awesome from NPM, and even trying to install it from Bower package ...

React-native-web cannot be installed when using React 18

Encountered errors while running npm install react-native-web. Despite creating a bug report, the issue remained unresolved. npm install react-native-web npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree ... Below is an example of ...

Numerous HTML documents being uploaded to the server for a multitude of individuals

Currently, I am developing a game on a website where players create new rooms and are assigned specific roles with individual powers. Some players need to wait for input from others, creating a dynamic gameplay experience. Additionally, there are certain ...

Channel name not recognized - What might be triggering this issue?

Currently, I am in the process of developing a website that will feature a chatbox with multiple channels catering to different languages. It will also have separate channels for moderators and announcements. I encountered an error message stating "invali ...

How to properly create a Dockerfile using Node.js as the backend

Currently, I am developing a straightforward Angular application that relies on Node.js as the backend for file uploading. The structure of my project folder is shown below: To execute this setup in Angular, I follow these steps: Run 'ng ...

Error: Python executable "python" not found by Npm, consider setting the PYTHON environment variable on Windows 10

When attempting to run the npm i command on my project, I encountered an error stating that it cannot find the Python executable python. It suggested setting the PYTHON environment variable. Can anyone provide assistance with this issue? Many thanks in adv ...

Ways to include a CSS file path in a link tag from an npm package

I have recently installed a package using npm. npm install lightgallery Now, I am trying to fill the href attribute of a link with the css file directory of this package. Here is what I have so far: <link rel="stylesheet" href="/node_mod ...

Vueify is unable to import a component from the node_modules directory

Check out my latest npm package Step one, I begin by installing it. npm install asva-vue-filters Next, I include the package in my javascript file: var vueFilters = require('asva-vue-filters') However, I encounter a barrage of errors like th ...

Encountering issues with npm-adduser when trying to input credentials for npm account

After developing an npm package on one machine, I cloned it to a different machine and encountered an error when trying to run npm publish: npm ERR! need auth auth and email required for publishing npm ERR! need auth You need to authorize this machine usi ...

Instructions for compiling node-sass within the present directory for specific files

In my project, the directory structure looks like this: - folder1 - styles1.scss - folder2 - styles2.scss I want to utilize node-sass through the command line to generate the following output: - folder1 - styles1.scss - styles1.css - folder2 ...

A syntax error has been identified when using a globally installed npm package for a CLI Node.js/CoffeeScript application

My command-line application is written in coffee-script and utilizes commander (https://github.com/tj/commander.js) to handle arguments. Within my bin directory, I have three files: mediatidy mediatidy-config mediatidy-media When running bin/mediatidy wi ...

It appears that the Node npm installation is deploying a distinct release compared to the one found on GitHub

On GitHub, I have noticed the desired version of generator-webapp; however, after performing an npm install, it appears to be providing me with an outdated version. I have observed that the version number in the packages.json file has not been modified du ...

Steps for setting up node-openalpr on a Windows 10 system

While attempting to install npm i node-openalpr, an error is occurring: When using request for node-pre-gyp https download, I encounter a node-pre-gyp warning and error message. The package.json for node-openalpr is not node-pre-gyp ready, as certain pr ...

An issue arises when attempting to execute npm with React JS

I encountered an error after following the setup steps for a react configuration. Can anyone provide assistance? This is the content of the webpack.config.js file: var config = { entry: './main.js', output: { path:'/', ...

Discovering the most recent update date of Node packages

I recently noticed that one of the node dependencies my project relies on has been updated since a few days ago. The update caused my test suite to fail, even though I haven't made any changes to my code or package.json in that time. It seems like NPM ...