Seeking Assistance with Nuxt 3 App Deployment on Cloudflare Pages

Hey there!

I’m currently facing an issue while trying to deploy my Nuxt 3 app on Cloudflare Pages. The error message I’m encountering states that the ‘nuxt-security’ package is not found. I’ve exhausted all possible solutions and find myself stuck. Right now, my app is live on AWS, but I’m eager to transition it to Cloudflare Pages. If anyone has experience with this and can lend a hand, I would greatly appreciate it!

Can you provide any more details or a minimal way for us to reproduce the error? Do you have the nuxt-security package in your package.json? What’s the exact full error that you get in your build log?

To reproduce the error, please follow these steps:

  1. Install “nuxt-security” in your Nuxt.js application by adding it to your package.json.
  2. Attempt to deploy your application using Git.

It’s worth noting that my application is functioning perfectly, and it is currently live on AWS. I am using PM2 to manage the application’s runtime.

ERROR I got:

2023-10-08T17:13:08.480926Z > postinstall
2023-10-08T17:13:08.481158Z > nuxt prepare
2023-10-08T17:13:10.746552Z [error] Error while requiring module nuxt-security: Error: Cannot find module ‘/opt/buildhome/repo/nuxt-security’
2023-10-08T17:13:10.747337Z Require stack:
2023-10-08T17:13:10.747537Z - /opt/buildhome/repo/index.js
2023-10-08T17:13:10.747901Z [error] Cannot find module ‘/opt/buildhome/repo/nuxt-security’
2023-10-08T17:13:10.748202Z Require stack:
2023-10-08T17:13:10.748427Z - /opt/buildhome/repo/index.js
2023-10-08T17:13:10.748575Z Require stack:
2023-10-08T17:13:10.748722Z - index.js
2023-10-08T17:13:10.748941Z at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
2023-10-08T17:13:10.749077Z at Function.resolve (node:internal/modules/cjs/helpers:125:19)
2023-10-08T17:13:10.749236Z at Function._resolve [as resolve] (node_modules/jiti/dist/jiti.js:1:250334)

I resolved the issue by removing NODE_ENV=production to my environment variables. When you have NODE_ENV=production set in your environment variables, it prevents the installation of dev dependencies. Removing it fixed the problem

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