Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find package 'html-minifier-terser' imported from .../astro-single-file/index.js #1

Open
jChapman opened this issue Oct 27, 2022 · 1 comment

Comments

@jChapman
Copy link

After running astro add astro-single-file and attempting to run dev or build I get the following error (missing dependency?)

08:48:51 PM [astro] Unable to load /home/projects/nbwiabryp.github/astro.config.mjs

 error   Cannot find package 'html-minifier-terser' imported from /home/projects/nbwiabryp.github/node_modules/astro-single-file/index.js
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'html-minifier-terser' imported from /home/projects/nbwiabryp.github/node_modules/astro-single-file/index.js
    at InternalError.get (https://nbwiabryp--github.w.staticblitz.com/blitz.912cb019f8b62040b90085f00ac69aca69f51e29.js:6:292489)
    at instantiateModule (file:///home/projects/nbwiabryp.github/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:53495:15)

Did it from scratch on stack blitz and ran into the same issue, here's the full log of what I ran (also double checked that the astro config file did get updated)

~/projects/nbwiabryp.github 2s
❯ astro add astro-single-file
⚠ astro-single-file is not an official Astro package. Use at your own risk!
✔ Continue? … yes
✔ Resolving with third party packages...

  Astro will run the following command:
  If you skip this step, you can always run it yourself later

 ╭────────────────────────────────╮
 │ npm install astro-single-file  │
 ╰────────────────────────────────╯

✔ Continue? … yes
✔ Installing dependencies...

  Astro will make the following changes to your config file:

 ╭ astro.config.mjs ─────────────────────────────╮
 │ import { defineConfig } from 'astro/config';  │
 │                                               │
 │ // https://astro.build/config                 │
 │ import singleFile from "astro-single-file";   │
 │                                               │
 │ // https://astro.build/config                 │
 │ export default defineConfig({                 │
 │   integrations: [singleFile()]                │
 │ });                                           │
 ╰───────────────────────────────────────────────╯

✔ Continue? … yes
  
   success  Added the following integration to your project:
  - astro-single-file

~/projects/nbwiabryp.github 16s
❯ astro dev
08:48:51 PM [astro] Unable to load /home/projects/nbwiabryp.github/astro.config.mjs

 error   Cannot find package 'html-minifier-terser' imported from /home/projects/nbwiabryp.github/node_modules/astro-single-file/index.js
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'html-minifier-terser' imported from /home/projects/nbwiabryp.github/node_modules/astro-single-file/index.js
    at InternalError.get (https://nbwiabryp--github.w.staticblitz.com/blitz.912cb019f8b62040b90085f00ac69aca69f51e29.js:6:292489)
    at instantiateModule (file:///home/projects/nbwiabryp.github/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:53495:15)
@tobias-edwards
Copy link

tobias-edwards commented Apr 17, 2023

Like you, I installed html-minifier-terser separately and it seems to work on macOS.

This plugin does only seem to work for single pages only i.e. a website with a nested route will not inline the CSS correctly. Astro intend to support inlining CSS natively: withastro/roadmap#556

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants