Error: Cannot find module 'ajv/dist/compile/codegen'
veleiken
HOBBYOP

21 days ago

1

RUN npm run build

2s

> neighborhoodpulse_sa-frontend@0.1.0 build

> react-scripts build

node:internal/modules/cjs/loader:1143

throw err;

^

Error: Cannot find module 'ajv/dist/compile/codegen'

Require stack:

- /app/node_modules/ajv-formats/dist/limit.js

- /app/node_modules/ajv-formats/dist/index.js

- /app/node_modules/schema-utils/dist/validate.js

- /app/node_modules/schema-utils/dist/index.js

- /app/node_modules/terser-webpack-plugin/dist/index.js

- /app/node_modules/react-scripts/config/webpack.config.js

- /app/node_modules/react-scripts/scripts/build.js

at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)

at Module._load (node:internal/modules/cjs/loader:981:27)

at Module.require (node:internal/modules/cjs/loader:1231:19)

at require (node:internal/modules/helpers:177:18)

at Object.<anonymous> (/app/node_modules/ajv-formats/dist/limit.js:5:19)

at Module._compile (node:internal/modules/cjs/loader:1364:14)

at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)

at Module.load (node:internal/modules/cjs/loader:1203:32)

at Module._load (node:internal/modules/cjs/loader:1019:12)

at Module.require (node:internal/modules/cjs/loader:1231:19) {

code: 'MODULE_NOT_FOUND',

requireStack: [

'/app/node_modules/ajv-formats/dist/limit.js',

'/app/node_modules/ajv-formats/dist/index.js',

'/app/node_modules/schema-utils/dist/validate.js',

'/app/node_modules/schema-utils/dist/index.js',

'/app/node_modules/terser-webpack-plugin/dist/index.js',

'/app/node_modules/react-scripts/config/webpack.config.js',

'/app/node_modules/react-scripts/scripts/build.js'

]

}

Node.js v18.20.8

Dockerfile:37

-------------------

35 |

36 | # Build the React app

37 | >>> RUN npm run build

38 |

39 | # Expose port (Railway will set PORT env var)

-------------------

ERROR: failed to build: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

Solved$10 Bounty

7 Replies

Railway
BOT

21 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


veleiken
HOBBYOP

21 days ago

Hi! guys. anyone help with this ajv issue please!


veleiken
HOBBYOP

21 days ago

How does one find the right way to install ajv successful?


I assume the Docker container is able to run npm run build successfully in a local environment?


0x5b62656e5d

I assume the Docker container is able to run npm run build successfully in a local environment?

veleiken
HOBBYOP

21 days ago

Meaning you have to deploy the project with node modules included?


veleiken

Meaning you have to deploy the project with node modules included?

Can you set your build command to be npm install --save-dev ajv@^7 && npm i ?


samgordon

Can you set your build command to be npm install --save-dev ajv@^7 && npm i ?

veleiken
HOBBYOP

21 days ago

It is fixed thanks, I remove the override on the dockerfile that was causing error!


Status changed to Solved samgordon 21 days ago


Loading...