-
-
Notifications
You must be signed in to change notification settings - Fork 182
v1/en/docs/getting-started/installation/hugo-module/ #937
-
v1/en/docs/getting-started/installation/hugo-module/
This article refers to the modern, up-to-date installation method of installing the theme locally as Hugo module.
Proxy (Optional) If you’re located at China mainland without VPN, the Hugo module download may fail.
There are two proxies for this: GOPROXY.CN and GOPROXY.IO.
1$ export HUGO_MODULE_PROXY=https://goproxy.cn Please note that, Hugo doesn’t respect the GOPROXY env var, please use HUGO_MODULE_PROXY instead.
You can also set the module.proxy instead of using env var.
https://hbs.razonyang.com/v1/en/docs/getting-started/installation/hugo-module/
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 5 replies
-
Hello, I followed 3. Install on an existing site
to install HBS. When I ran hugo server
, I got an error Cannot find module 'autoprefixer'
So I tried to npm install autoprefixer
, but it still said the same thing. The complete err mesage is as follows:
$ hugo server
Start building sites ...
hugo v0.111.3+extended darwin/arm64 BuildDate=unknown
Error: Error building site: POSTCSS: failed to transform "assets/main/bundle.min.css" (text/css): Error: Cannot find module 'autoprefixer'
Require stack:
- /private/var/folders/0x/9zf3vjq10qg1fzx57wstyr440000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/razonyang/hugo-theme-bootstrap@v1.0.1-0.20230503155058-29cba7fd53b2/postcss.config.js
- /Volumes/Extreme SSD/blog/Hugo/jek/node_modules/lilconfig/dist/index.js
- /Volumes/Extreme SSD/blog/Hugo/jek/node_modules/postcss-load-config/src/index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
at Module._load (node:internal/modules/cjs/loader:928:27)
at Module.require (node:internal/modules/cjs/loader:1149:19)
at require (node:internal/modules/helpers:121:18)
at Object.<anonymous> (/private/var/folders/0x/9zf3vjq10qg1fzx57wstyr440000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/razonyang/hugo-theme-bootstrap@v1.0.1-0.20230503155058-29cba7fd53b2/postcss.config.js:2:22)
at Module._compile (node:internal/modules/cjs/loader:1267:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Module.require (node:internal/modules/cjs/loader:1149:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/private/var/folders/0x/9zf3vjq10qg1fzx57wstyr440000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/razonyang/hugo-theme-bootstrap@v1.0.1-0.20230503155058-29cba7fd53b2/postcss.config.js',
'/Volumes/Extreme SSD/blog/Hugo/jek/node_modules/lilconfig/dist/index.js',
'/Volumes/Extreme SSD/blog/Hugo/jek/node_modules/postcss-load-config/src/index.js'
]
}
Built in 1504 ms
Thank you in advance for your kind help.
Beta Was this translation helpful? Give feedback.
All reactions
-
I couldn't reproduce it, is there any file located in node_modules/autoprefixer
? If not, please reinstall the autoprefixer via npm install autoprefixer
. Please also check if it's the right working directory (site/repo root).
If the issue still present, would you mind providing your site repo for me to reproduce this issue?
$ tree node_modules/autoprefixer node_modules/autoprefixer ... 4 directories, 83 files
Beta Was this translation helpful? Give feedback.
All reactions
-
@razonyang, I appreciate your reply. I also tried to do a fresh installation of HBS using your starter template, ran hugo server
under the site root and the same error still appears. My repo is https://github.com/khoguan/hugo-theme-bootstrap-skeleton.git
$ tree node_modules/autoprefixer
node_modules/autoprefixer
...
5 directories, 83 files
$ go version
go version go1.20.4 darwin/arm64
$ hugo version
hugo v0.111.3+extended darwin/arm64 BuildDate=unknown
$ npm version
{
'hugo-theme-bootstrap-skeleton': '0.1.0',
npm: '9.6.6',
node: '20.0.0',
acorn: '8.8.2',
ada: '2.0.0',
ares: '1.19.0',
brotli: '1.0.9',
cldr: '42.0',
icu: '72.1',
llhttp: '8.1.0',
modules: '115',
napi: '8',
nghttp2: '1.52.0',
nghttp3: '0.7.0',
ngtcp2: '0.8.1',
openssl: '3.0.8+quic',
simdutf: '3.2.7',
tz: '2023c',
undici: '5.21.0',
unicode: '15.0',
uv: '1.44.2',
uvwasi: '0.0.16',
v8: '11.3.244.4-node.3',
zlib: '1.2.13'
}
Beta Was this translation helpful? Give feedback.
All reactions
-
That's weird, your repo works as expected.
$ git clone git@github.com:khoguan/hugo-theme-bootstrap-skeleton.git
Cloning into 'hugo-theme-bootstrap-skeleton'...
remote: Enumerating objects: 889, done.
remote: Counting objects: 100% (889/889), done.
remote: Compressing objects: 100% (409/409), done.
remote: Total 889 (delta 348), reused 787 (delta 285), pack-reused 0
Receiving objects: 100% (889/889), 2.04 MiB | 51.00 KiB/s, done.
Resolving deltas: 100% (348/348), done.
$ cd hugo-theme-bootstrap-skeleton
$ npm i
added 504 packages in 13s
47 packages are looking for funding
run `npm fund` for details
$ hugo server
port 1313 already in use, attempting to use an available port
Start building sites ...
hugo v0.111.3-5d4eb5154e1fed125ca8e9b5a0315c4180dab192+extended linux/amd64 BuildDate=2023年03月12日T11:40:50Z VendorInfo=gohugoio
| EN | ZH-HANS
-------------------+----+----------
Pages | 65 | 63
Paginator pages | 0 | 0
Non-page files | 2 | 2
Static files | 63 | 63
Processed images | 36 | 8
Aliases | 28 | 27
Sitemaps | 2 | 1
Cleaned | 0 | 0
Built in 3352 ms
Watching for changes in /tmp/a/hugo-theme-bootstrap-skeleton/{archetypes,assets,content,layouts,package.hugo.json,package.json,static}
Watching for config changes in /tmp/a/hugo-theme-bootstrap-skeleton/config/_default, /tmp/a/hugo-theme-bootstrap-skeleton/go.mod
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:35047/ (bind address 127.0.0.1)
Press Ctrl+C to stop
Beta Was this translation helpful? Give feedback.
All reactions
-
I have tried to install via Hugo module but failed on both of my Mac mini M1 (macOS 13.3.1) and Macbook Pro 2018 (macOS 12.6.5) with the same error Cannot find module 'autoprefixer'
, even after i uninstalled autoprefixer and reinstalled it. Then I installed Ubuntu 22.04 ARM64 on Parallels Desktop 18 for Mac and ran hugo server
in Ubuntu and succeeded! I also successfully installed and ran HBS via git submodule on my Mac mini. Thanks a lot for your time and kindness to help me.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
@razonyang, I would like to inform you that my issue has been resolved. It was caused by node
installed via nvm
which does not correctly set NODE_PATH. Here is the solution. Sorry to bother you with a problem not directly related to your theme and thank you very much again.
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
Np, thanks for sharing the solution, it definitely helps others.
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1