remix-pwa / monorepo

Remix PWA v4
https://remix-pwa.run
MIT License
105 stars 23 forks source link

Can't call `npx remix-pwa sw` #248

Closed Stephan-MDD closed 1 month ago

Stephan-MDD commented 1 month ago

Hi I have a Remix project and I get an error when I call npx remix-pwa sw.
I Created the project with npx create-remix@latest - my package.json is at the bottom :)

Versions

Name Version
node 20.9.0
npm 10.1.0
macOS  Sonoma 14.5

Issue

npx remix-pwa sw
node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///Users/marc/.npm/_npx/3c34892bd302acc6/node_modules/@remix-pwa/cli/package.json" needs an import assertion of type "json"
    at new NodeError (node:internal/errors:406:5)
    at validateAssertions (node:internal/modules/esm/assert:94:15)
    at defaultLoad (node:internal/modules/esm/load:122:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:396:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:56)
    at new ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:290:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:248:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:229:17)
    at async ModuleLoader.import (node:internal/modules/esm/loader:315:23) {
  code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}

Node.js v20.9.0

Package.json

{
  "name": "website",
  "private": true,
  "sideEffects": false,
  "type": "module",
  "scripts": {
    "build": "remix vite:build",
    "dev": "remix vite:dev",
    "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
    "start": "remix-serve ./build/server/index.js",
    "typecheck": "tsc"
  },
  "dependencies": {
    "@remix-pwa/worker-runtime": "^2.1.2",
    "@remix-run/node": "^2.10.3",
    "@remix-run/react": "^2.10.3",
    "@remix-run/serve": "^2.10.3",
    "isbot": "^4.1.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@remix-pwa/dev": "^3.0.6",
    "@remix-run/dev": "^2.10.3",
    "@types/react": "^18.2.20",
    "@types/react-dom": "^18.2.7",
    "@typescript-eslint/eslint-plugin": "^6.7.4",
    "@typescript-eslint/parser": "^6.7.4",
    "autoprefixer": "^10.4.19",
    "eslint": "^8.38.0",
    "eslint-import-resolver-typescript": "^3.6.1",
    "eslint-plugin-import": "^2.28.1",
    "eslint-plugin-jsx-a11y": "^6.7.1",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "postcss": "^8.4.38",
    "tailwindcss": "^3.4.4",
    "typescript": "^5.1.6",
    "vite": "^5.1.0",
    "vite-tsconfig-paths": "^4.2.1"
  },
  "engines": {
    "node": ">=20.0.0"
  }
}

Thanks in advanced - thanks for making awesome tools :D

ShafSpecs commented 1 month ago

Oh, I think I have seen error 🫤. It's a breaking change in Node 21/22 (in pre-21, json imports are assert: { type: 'json' }, whilst it's now with: { type: 'json' } in newer node versions. How do I support both 🤔? Give me a minute pls!

Stephan-MDD commented 1 month ago

No stress my friend 😊 hope you find a solution💪

ShafSpecs commented 1 month ago

Released remix-pwa@4.0.4 (😁). That should fix the issue, if it solves it, please close this issue. Thx 👍

Stephan-MDD commented 1 month ago

You are a genius - thanks!