Remix Netlify build error

Когда я выполняю команду npx create-remix@latest --template netlify/remix-template всё работает. Но я туда добавляю пару нужных зависимостей:

"@google-cloud/storage": "^7.7.0", 
"@remix-run/css-bundle": "^2.4.0", 
"bcryptjs": "^2.4.3", 
"mongodb": "^6.3.0"

После чего при старте npm run dev я получаю ошибку:

Runtime.UserCodeSyntaxError - SyntaxError: Named export 'Response' not found. The requested module '@remix-run/node' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using: import pkg from '@remix-run/node'; const { Response: Response2 } = pkg;

И она находится:

import pkg from '@remix-run/node';
const { Response: Response2 } = pkg;

at _loadUserApp (file:///var/runtime/index.mjs:1084:17)
at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)
at async start (file:///var/runtime/index.mjs:1282:23)
at async file:///var/runtime/index.mjs:1288:1

И этот const { Response: Response2 } = pkg; находится в build/undex.js, соответственно, я не могу импортировать туда нужный пекедж.

Весь package.json:

{
  "name": "root4",
  "private": true,
  "sideEffects": false,
  "type": "module",
  "scripts": {
    "build": "remix build",
    "dev": "remix dev",
    "start": "netlify serve",
    "typecheck": "tsc -b"
  },
  "dependencies": {
    "@netlify/functions": "^2.0.0",
    "@netlify/remix-adapter": "^2.0.0",
    "@prisma/client": "^5.5.2",
    "@remix-run/node": "^2.4.1",
    "@remix-run/react": "^2.4.1",
    "cross-env": "^7.0.3",
    "react": "^18.2.0",
    "react-dom": "^18.2.0", 
    "@google-cloud/storage": "^7.7.0", 
    "@remix-run/css-bundle": "^2.4.0", 
    "bcryptjs": "^2.4.3", 
    "mongodb": "^6.3.0"
  },
  "devDependencies": {
    "@remix-run/dev": "^2.4.1",
    "@remix-run/eslint-config": "^2.4.1",
    "@remix-run/serve": "^2.4.1",
    "@types/react": "^18.2.0",
    "@types/react-dom": "^18.2.0",
    "eslint": "^8.27.0",
    "prisma": "^5.5.2",
    "typescript": "^5.2.2"
  },
  "engines": {
    "node": ">=18"
  }
}

Не могу понять, что не так, почему эта ошибка появляется и как её исправить.


Ответы (0 шт):