Node.js in Docker is unable to generate an image

the image:

# pulling the official base image
FROM node:17.5

# setting up the working directory
WORKDIR /app

# including `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# installing application dependencies
COPY package.json ./
COPY package-lock.json ./
RUN npm install -g <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="086678654830263d2639">[email protected]</a>
RUN npm ci

# adding the app
COPY . ./

# starting the app
CMD ["npm", "start"]

an error encountered:

[+] Building 71.9s (10/11)                                                                                                                                                                                                              
 => [internal] loading build definition from Dockerfile                                                                                                                                                                               0.0s
 => => transferring dockerfile: 372B                                                                                                                                                                                               0.0s
 => [internal] loading .dockerignore                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                    0.0s
 => [internal] loading metadata for docker.io/library/node:17.5                                                                                                                                                                       0.7s
 => [1/7] FROM docker.io/library/node:17.5@sha256:a0590a265b222387d756ba357c4a9875778f1a7638ac011f3fb4942d3b7ae5c0                                                                                                                 0.0s
 => [internal] loading build context                                                                                                                                                                                                  1.2s
 => => transferring context: 3.06MB                                                                                                                                                                                                1.1s
 => CACHED [2/7] WORKDIR /app                                                                                                                                                                                                      0.0s
 => CACHED [3/7] COPY package.json ./                                                                                                                                                                                              0.0s
 => CACHED [4/7] COPY package-lock.json ./                                                                                                                                                                                         0.0s
 => [5/7] RUN npm install -g <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="513f213c11697f647f60">[email protected]</a>                                                                                                                                                                                             9.2s
 => ERROR [6/7] RUN npm ci                                                                                                                                                                                                        60.8s
------
 > [6/7] RUN npm ci:                                                                                                                                                                                                                    
#10 11.25 npm WARN deprecated <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8cbcedfd7f889968b968a">[email protected]</a>: This SVGO version is no longer supported. Upgrade to v2.x.x.                                                                                                                                  
#10 11.80 npm WARN deprecated <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4f3c203a3d2c2a62222e3f623a3d230f7f617b617e">[email protected]</a>: See https://github.com/lydell/source-map-url#deprecated                                                                                                                             
#10 11.94 npm WARN deprecated <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c2b1adb7b0a1a7efafa3b2efb0a7b1adaeb4a782f2ecf4ecf2">[email protected]</a>: See https://github.com/lydell/source-map-resolve#deprecated                                                                                                                     
... (truncated for brevity)
executor failed running [/bin/sh -c npm ci]: exit code: 1

Answer №1

There seems to be an issue with the following line in the docker file.

# include `/app/node_modules/.bin` in $PATH
ENV PATH /app/node_modules/.bin:$PATH

Could you modify it to

# include `/app/node_modules/.bin` in $PATH
ENV PATH="/app/node_modules/.bin:$PATH"

and test it out?

More information can be found at: https://docs.docker.com/engine/reference/builder/#environment-replacement

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

What could be the reason for the malfunction of the select (mongoose query)?

I'm trying to retrieve a User's highest score post. To accomplish this, I am querying the Post model and looking for posts where their user._id matches the author in the post. Everything is functioning correctly in this regard. However, my goal ...

Proper method to serve a file located within the node_modules directory

When working with a library, there may be limitations on making certain calls. In this specific case: app.use('/node_modules', express.static('node_modules')); An alternative approach is necessary due to restrictions on how the server ...

Ways to fix the error message 'yarn package has unresolved peer dependency'

Whenever I run yarn upgrade or install, a bunch of warnings pop up due to unmet peerDependencies. warning " > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4322332c2f2f2c6e2f2a2d286e2b37373303726d766d7a">[email pro ...

While Mongoose.create is successfully inserting data into the database, it is also capturing any errors that may

I'm currently in the process of developing a RESTful API for products to handle CRUD operations. Utilizing MongoDB as my database and combining it with mongoose and express, I aim to efficiently access the data. However, upon attempting to create a ne ...

using node.js to save query results as global variables

Help needed! I'm struggling to pass the results of my query statement to a global variable in order to dynamically configure my jsganntimproved chart. Any suggestions on what could be going wrong? In the snippet below, the console.log(taskItem) retur ...

Sorry, but I cannot install expo dependencies at this time

I am currently using nvm to switch between node versions 4.4.3 and 12.14.1. After switching to version 12.14.1, I tried to install expo and run a react-native project following the instructions here. npm install -g expo-cli expo init npm start However, w ...

Karma encountered an error while trying to resolve the file path for "../../services/service.ts" in the preprocessor.rollup

Currently, I am facing an issue while trying to test a testsuite using CI (Bamboo). The problem arises when deploying the fully functional application from my local system to the Bamboo server (which I do not have configuration access to). The call npm -- ...

Performing Batch Writes in Firestore using the Admin SDK

I have a massive ASCII flat file containing 1.5 million lines, which is essentially a list of parts from a manufacturer. I want to store this data in Firestore. Originally saved as a .csv file, the size was 250GB. After converting it to a JSON file using ...

What distinguishes the sequence of events when delivering a result versus providing a promise in the .then method?

I've been diving into the world of Promises and I have a question about an example I found on MDN Web Docs which I modified. The original code was a bit surprising, but after some thought, I believe I understood why it behaved that way. The specific ...

Is it possible to incorporate Material-UI Lab into my project without having to install the Core components as well?

I'm hoping to incorporate the Slider component from Material UI into my React application. The Slider is one of the components housed in the 'Lab' package, which acts as an incubator for features that aren't quite ready for the core. n ...

Tips for verifying user authentication with OAuth2 in a React and Express Node app

Despite looking at various resources on this subject, I'm still struggling to find a solution to my specific issue. I've been utilizing the Strava API, which operates on OAuth 2.0. The process involves: Clicking the connect button Redirecting t ...

How to handle a Node.js promise that times out if execution is not finished within a specified timeframe

return await new Promise(function (resolve, reject) { //some work goes here resolve(true) }); Using Delayed Timeout return await new Promise(function (resolve, reject) { //some work goes here setTimeout(function() { resolve(true); }, 5000); } ...

The React syntax is malfunctioning

componentDidMount() { const restaurants = Restaurant.all() restaurants.then( rests => { this.setState({ restaurants: rests }) }) } render() { const { restauran ...

Navigating the issue of updateMany not functioning properly in mongoose and nodejs

I need assistance with updating the author name of a post whenever the user updates their profile name. My code is as follows: router('/:id', async (req, res) { if (req.body._id == req.params.id) { try { const user = await ...

What to do when nodeenv does not link grunt after being installed using npm install -g?

When using nodeenv, I am facing an issue where binaries are not getting linked for npm installed modules. $ mkvirtualenv venv (venv)$ pip install nodeenv (venv)$ nodeenv -p (venv)$ deactivate $ workon venv (venv)$ which grunt /usr/local/bin/grunt (venv)$ ...

Can you help me identify the issue with my current Jade for loop implementation?

Here is my full loop code written in Jade: block content div(class='row') div(class='col-lg-12') h1(class='subject') 로또라이 div(class='row') div(class='col-lg-8') - for (var ...

Steps for defining local variables accessible across all EJS templates:1. Begin by creating a helper function

When setting local variables in the /login router as shown in the code snippet below: res.locals.username = data[0].username;, I have checked the output using console.log for both data[0].username and res.locals.username, and it correctly displays the user ...

Encountered an issue trying to access undefined properties in the mongoose response object

When utilizing the mongoose Schema in node.js, I have defined the following structure: mongoose.Schema({ name: { type: String, required: true }, userId: { type: String }, water: { type: Array }, fertilizer: { type: Array } }) Subsequently, ...

My goal is to send distinct entries for each user that accesses the system from a MySQL database

As a beginner, I need help figuring out how to send each logged-in user a list of unique records from the database. I want to ensure that no duplicate records are sent to different users. How can I achieve this? Below is the code snippet responsible for ...

Allow Nest.js server to receive binary files in the request body

Is there a way to retrieve the uploaded binary file data from the browser? While the Nest.js server application functions correctly with Postman, it throws a 400 error when the request is sent from the Google Chrome/Angular application. Any ideas on how ...