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

Error: Cannot find module 'less' #322

Open
MaxAlekseyev opened this issue Mar 11, 2023 · 2 comments
Open

Error: Cannot find module 'less' #322

MaxAlekseyev opened this issue Mar 11, 2023 · 2 comments

Comments

@MaxAlekseyev
Copy link

gulp less --luma - ok
gulp exec --isb - ok

but gulp less --isb failed

[19:48:18] Using gulpfile /var/www/domains/isb.wsl/gulpfile.js
[19:48:18] Starting 'less'...
Running gulp task LESS compilation for 1 theme(s):
isb
[19:48:18] 'less' errored after 78 ms
[19:48:18] Error: Cannot find module 'less'
Require stack:
- /var/www/domains/isb.wsl/node_modules/accord/lib/index.js
- /var/www/domains/isb.wsl/node_modules/gulp-less/index.js
- /var/www/domains/isb.wsl/node_modules/gulp-load-plugins/index.js
- /var/www/domains/isb.wsl/dev/tools/gulp/tasks/less.js
- /var/www/domains/isb.wsl/node_modules/require-dir/index.js
- /var/www/domains/isb.wsl/gulpfile.js
- /usr/local/lib/node_modules/gulp-cli/lib/shared/require-or-import.js
- /usr/local/lib/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- /usr/local/lib/node_modules/gulp-cli/index.js
- /usr/local/lib/node_modules/gulp-cli/bin/gulp.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Function.resolve (node:internal/modules/helpers:125:19)
    at resolve_engine_path (/var/www/domains/isb.wsl/node_modules/accord/lib/index.js:65:18)
    at exports.load (/var/www/domains/isb.wsl/node_modules/accord/lib/index.js:25:19)
    at Object.<anonymous> (/var/www/domains/isb.wsl/node_modules/gulp-less/index.js:9:29)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

@MaxAlekseyev
Copy link
Author

Ubuntu 20.04 on WSL2

 gulp -v
CLI version: 2.3.0
Local version: 4.0.2

@fzxen
Copy link

fzxen commented Jul 9, 2024

I found v5 already fixed this error.

I encountered the same error with pnpm.

Gulp-less use accord.load to load less instead of require. However, accord.load doesn't change require context.
image

maybe need specify path to load like this:

accord.load('less', __dirname);

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