next-theme / next-theme/hexo-optimize

`imagemin` dependency

Open
#2 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
16
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Error encountered

When running hexo generate

ERROR Plugin load failed: hexo-optimize
Error: Cannot find module 'imagemin'

_config.yml was the same as README indicated.

# https://github.com/next-theme/hexo-optimize#readme
filter_optimize:
  enable: true
  # remove the surrounding comments in each of the bundled files
  remove_comments: false
  css:
    # minify all css files
    minify: true
    # bundle loaded css files into one
    bundle: true
    # use a script block to load css elements dynamically
    delivery: true
    # make specific css content inline into the html page
    #   - only support the full path
    #   - default is ['css/main.css']
    inlines:
    excludes:
  js:
    # minify all js files
    minify: true
    # bundle loaded js files into one
    bundle: true
    excludes:
  # set the priority of this plugin,
  # lower means it will be executed first, default of Hexo is 10
  priority: 12

Solution

I installed these dependencies manually and it succeeded.

npm install imagemin imagemin-mozjpeg imagemin-pngquant imagemin-gifsicle imagemin-jpegtran imagemin-optipng imagemin-svgo 

And I need to install autoconf system-wide since imagemin-gifsicle failed to fetch pre-built binary and I had to compile it.

Should we add imagemin and plugins to dependencies?

My package.json : package.zip

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect package.json and compare its declared dependencies with the imagemin packages listed in the issue. Reproduce the failure with hexo generate, then verify that a clean install provides the required packages without manual installation and that generation succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.