Build fails on missing module

Hi,

I am new to Cloudflare, and I can’t seem to get my react app to build in Cloudflare pages.
I am using some npm modules (luxon and humanizeDuration).
Since using them, each build fails stating that :
Can’t resolve ‘humanize-duration’ in ‘/opt/buildhome/repo/src’

When I only had luxon referenced, the error message complained about not being able to resolve luxon.

Is there a setting I am missing so that npm modules get downloaded for the build? The app builds and runs happily on my machine.

Regards,

Do you have a screenshot of your package.json?

One thing to note is that devDependencies aren’t installed by default.

Sure :slight_smile:

well maybe not. I am new user and cannot upload images…

I have 2 package.json
One in root folder : for yarn I guess (including my npms)

{
  "packageManager": "[email protected]",
  "dependencies": {
    "humanize-duration": "^3.27.1",
    "luxon": "^2.4.0"
  }
}

One in src folder with all react app deps. (not including my npms)

{
  "name": "42stats-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@mui/icons-material": "^5.6.0",
    "@mui/material": "^5.6.0",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-scripts": "5.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

How

Ok,
Answer to my question : npm deps should be in the package.json in the react app folder.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.