docsy icon indicating copy to clipboard operation
docsy copied to clipboard

Cannot find module 'autoprefixer'

Open markgoho opened this issue 2 years ago • 3 comments

Trying to build docsy locally with hugo and cannot get past this step:

Start building sites … 
hugo v0.98.0-165d299cde259c8b801abadc6d3405a229e449f6+extended windows/amd64 BuildDate=2022-04-28T10:23:30Z VendorInfo=gohugoio
Error: Error building site: POSTCSS: failed to transform "scss/main.css" (text/css): Error: Loading PostCSS Plugin failed: Cannot find module 'autoprefixer'
Require stack:
- C:\Users\Mark\AppData\Local\Temp\hugo_cache\modules\filecache\modules\pkg\mod\github.com\google\[email protected]\postcss.config.js

(@C:\Users\Mark\AppData\Local\Temp\hugo_cache\modules\filecache\modules\pkg\mod\github.com\google\[email protected]\postcss.config.js)
    at load (D:\IdeaCrew\GitHub\sbm-docs\node_modules\postcss-load-config\src\plugins.js:28:11)
    at D:\IdeaCrew\GitHub\sbm-docs\node_modules\postcss-load-config\src\plugins.js:53:16
    at Array.map (<anonymous>)
    at plugins (D:\IdeaCrew\GitHub\sbm-docs\node_modules\postcss-load-config\src\plugins.js:52:8)
    at processResult (D:\IdeaCrew\GitHub\sbm-docs\node_modules\postcss-load-config\src\index.js:37:14)
    at D:\IdeaCrew\GitHub\sbm-docs\node_modules\postcss-load-config\src\index.js:151:14
    at async Promise.all (index 0)

markgoho avatar May 04 '22 17:05 markgoho

Please have a look at this section in the docsy user guide:

What it comes down to: from the root folder of your project, run:

npm install -D autoprefixer
npm install -D postcss-cli
npm install -D postcss

Afterwards, you should get:

$ npm list
[email protected] your\path\to\yoursite
├── [email protected]
├── [email protected]
└── [email protected]

Does this fix your problem?

deining avatar May 04 '22 17:05 deining

thanks @deining -- I've got those in my package.json in the root of the project and have tried installing these as devDependencies, dependencies, and as global dependencies (with the -g flag when installing). All of these result in the same error above.

one thing I'm looking into is the fact that I've cloned the site into a folder in my project -- perhaps there are some hard-coded paths in the build process that expect the hugo site to be at the root of the project

markgoho avatar May 04 '22 18:05 markgoho

Might be useful to have a look at the Docsy user guide in this repo to compare settings? It's not at the project root.

LisaFC avatar May 13 '22 10:05 LisaFC

It seems like you might need to upgrade your version of Node. For details see, Install/Upgrade Node.js. Can you give that a try and let us know if that resolved the issue for you?

chalin avatar Aug 18 '22 08:08 chalin

Actually, I'm quite sure that this is a dup of #464 so I'll close this for now, if you still have the problem add a comment here and I'll reopen the issue.

chalin avatar Aug 18 '22 08:08 chalin