Error: Docker/Next.js cannot locate module '@mui/x-date-pickers/AdapterDateFns' or its respective type definitions

When I run the command npm run build, my Next.js application builds successfully without any issues.

However, when I try to build it in my Dockerfile, I encounter the following problem:

#0 12.18 Type error: Cannot find module '@mui/x-date-pickers/AdapterDateFns' or its corresponding type declarations.
#0 12.18
#0 12.18   4 | import useupdateManifest from 'src/hooks/manifest/useUpdateManifest';
#0 12.18   5 | import { manifests } from 'src/types/manifest/manifests';
#0 12.18 > 6 | import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
#0 12.18     |                                ^
#0 12.18   7 | import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
#0 12.18   8 | import { MobileDatePicker } from '@mui/x-date-pickers/MobileDatePicker';#0 12.18   9 | import { branchVehicleStoreVar } from 'src/Store/branchVehicleStore';
------
failed to solve: executor failed running [/bin/sh -c npm run build]: exit code: 1

This is a list of dependencies from my package.json file:

"dependencies": {
    // List of dependencies here
  },

I would greatly appreciate any assistance with this issue. Thank you in advance.

Dockerfile:

# Instructions for Dockerfile
FROM node:alpine

WORKDIR /app

COPY ./package.json .

RUN npm install --force

COPY . .

RUN npm run build

EXPOSE 8101

CMD ["npm", "run", "start" ]

Docker-compose file:

version: '3.8'
services: 
    frontend:
        build: .
        container_name: next_c
        ports: 
          - '8101:8101'
        stdin_open: true
        tty: true

.dockerignore file:

/.next/
/node_modules

Answer №1

Looks like @mui/x-date-pickers is missing from your list of dependencies.

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

Exploring various endpoints using firestore Cloud Function

I am in the process of creating a versatile Cloud Function that can be executed on various endpoints. This is how my original Cloud Function looks: const functions = require('firebase-functions') const admin = require('firebase-admin' ...

Unable to iterate through Ajax calls using For Loop when onChange event occurs

I'm struggling with looping the OnChange method using an AJAX call, but for some reason, it's not working as expected. for (let index = 0; index < 300; index++) { $('#txtLini'+[index]).on('change', function() { ...

What is the best way to navigate a dynamic table in Vue.js?

I'm currently working on creating dynamic tables in Vue using loops where users can upload a table and view it. <el-table :data="filtered" border style="width: 100%" height="500" @selection-change="handleSelectio ...

Filtering a string that contains commas using another string that also contains commas

I need help with removing elements from one comma-separated string based on another. String 1: 6,2 String 2: 1,2,4,5,6,7,9,12,13 Is there a function or method that can accomplish this task for me? ...

The Angular router seems to be refusing to show my component

My Angular 2 App includes a Module called InformationPagesModule that contains two lazy load components (Info1 Component and Info2 Component). I would like these components to load when accessing the following routes in the browser: http://localhost:4200/ ...

The functionality of window.location.href seems to be malfunctioning on mobile devices within an ionic application

Attempting to open a view with a function call from the UI side <ion-option-button class="button-light icon ion-chatbubble" ng-click="openView('username')"></ion-option-button> The controller code for this action is as follows: $sc ...

Invalid Hook Call error in Material UI framework

I am currently using a blog template, but I would like to switch to Material UI. However, every time I add the useStyles-Hook, I encounter an invalid hook error. Does anyone have a solution for implementing Material UI without facing this error? Thank you ...

Initializing JavaScript prior to registering the Polymer element

When upgrading from Polymer version v0.5 to v1.0, the process of registering Polymer elements seems to have changed. Previously, in Polymer v1.0, we were able to execute JavaScript code from the index.html file to initialize all the necessary objects in ou ...

Strategies for optimizing PPI and DPI in responsive design

Imagine having two monitors: one 15.5 inches with a resolution of 1920 x 1080 and the other 24 inches with the same resolution. The first monitor has a pixel density of around 72 PPI, while the second has around 90 PPI. If I apply a media query in CSS for ...

No children were located within the div element

Presently, I am attempting to disable an image for the initial element in each faqs div class in HTML. To achieve this, I am aiming to target the parent element of faqs and then navigate downwards to locate the initial list element using the following Java ...

Encountered a SyntaxError on JSON Web Tokens Node JS Server: Unexpected token } found in JSON at position 24

Me, along with others, have encountered this issue: SyntaxError: Unexpected token } in JSON at position 24 at JSON.parse (<anonymous>) while following a tutorial on JSON Web Tokens (TUTORIAL LINK: https://www.youtube.com/watch?v=mbsmsi7l3r4&t=34s ...

Executing a component's function from a JavaScript file

Is it possible in React to call a function or method of a component from a separate JS file in order to modify the component's state? Here are three example files: First, App.js import React,{Component} from 'react'; import Login from &ap ...

Synchronize CSS Properties with JavaScript Event

Is there a more efficient way to synchronize two properties using JavaScript or JQuery? For instance, when I have an editable text field and I switch it to an input box upon double click, how can I ensure that the input box adjusts its size along with the ...

What is the best way to add a value to the value attribute of a div using JavaScript?

Is there a way to insert a value into the value attribute of a div using Internet Explorer 9? I have attempted various JavaScript functions, but so far I can only modify the content inside the div and not the value attribute itself. <div id="mydiv" val ...

Why is the state object empty in this React Native function?

One React-Native component I have is responsible for rendering an image gallery in a list format. This component is called once for each item on the parent list. It takes two props: "etiqueta," which contains the title of the item, and "galleries," which i ...

Integrate actual credentials into S3Client using redux async thunk

My S3-like react application with redux is powered by AWS SDK v3 for JS. The client initialization in my auth.js file looks like this: auth.js export const s3Client = new S3Client({ region: 'default', credentials: { accessKeyId: 'te ...

Errors during the compilation of Webgl shaders in the Google Chrome browser

Currently, I am in the process of learning three.js by following this tutorial: . Despite the tutorial working well, I have encountered errors in my own code which seem like this: ERROR: 0:26: 'nuniform' : syntax error Three.js:325 precision hi ...

Combining multiple arrays of arrays in JavaScript

I am dealing with an array that contains nested arrays. This particular array is called template template consists of 2 arrays, but the number can vary and there can be multiple levels of arrays within each one. Here's what I have attempted: const ...

Border of MUI Select does not reach the label, creating empty space

I have been attempting to display a dropdown menu using @mui/material/Select. I am facing an issue where the top border of the dropdown does not extend all the way next to the label, leaving some white space on the right edge of the dropdown div. Upon insp ...

Anchor tags are not visible to Jquery

My issue is with integrating JQUERY and PHP. In my external PHP file, I have the following echo statement - `echo ("<a href='#' id='bb'>hello</a>"); Similarly, in my external js file, I have this JQUERY code - $(' ...