I'm trying to resurrect my automated KSS build process which died a year ago after I upgraded Node for another project.
KSS works fine when I run it directly via the command line ($ ./node_modules/kss/bin/kss --config kss-config.json
)
But when I run it via gulp using node spawn I get the following error:
user@computer /c/users/user/Documents/projects/kss
$ gulp
[12:04:42] Using gulpfile C:\users\user\Documents\projects\kss\gulpfile.js
[12:04:42] Starting 'default'...
[12:04:42] Starting 'compileKss'...
[12:04:42] 'compileKss' errored after 3.21 ms
[12:04:42] Error: spawn ./node_modules/kss/bin/kss ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
[12:04:42] 'default' errored after 6.78 ms
My gulp file looks like this:
'use strict'
/**
* Some useful links to help with understanding this file:
* * https://www.webstoemp.com/blog/switching-to-gulp4/
*/
const { series } = require('gulp')
const childProcess = require('child_process')
/**
* a Gulp task for compiling Sass files to CSS and creating source maps
*/
const compileKss = (gulpCallBack) => {
const kss = childProcess.spawn(
'./node_modules/kss/bin/kss',
[
'--config',
'./kss-config.json'
]
)
kss.on('exit', (code) => {
const errorMsg = (code === 0) ? null : 'ERROR: kss-node process exited with code: ' + code
gulpCallBack(errorMsg)
})
return kss
}
exports.default = series(compileKss)
and my kss config file looks like this:
{
"title": "KSS style guide",
"source": [
"./style-guide/css/"
],
"destination": "./style-guide/",
"homepage": "src/homepage.md",
"builder": "node_modules/michelangelo/kss_styleguide/custom-template",
"css": [],
"js": []
}
and my package.json looks like this:
{
"name": "KSS style-guide",
"description": "KSS style-guide",
"author": {},
"browserslist": [
"last 2 version",
"> 1%"
],
"bugs": {},
"contributors": [],
"dependencies": {},
"devDependencies": {
"acorn": "^7.1.0",
"browser-sync": "^2.26.7",
"compass-importer": "^0.4.1",
"concat": "^1.0.3",
"del": "^5.1.0",
"fancy-log": "^1.3.3",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-plumber": "^1.2.1",
"gulp-sass": "^4.0.2",
"gulp-sass-lint": "^1.4.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-terser": "^1.2.0",
"gulp-uglify": "^3.0.2",
"kss": "^3.0.0-beta.25",
"michelangelo": "^0.8.0",
"standard": "^14.3.1",
"terser": "^4.3.9"
},
"engines": {"node": ">=12"},
"engineStrict": true,
"repository": {},
"scripts": {},
"version": "0.0.1"
}
FYI: My system is using
- Windows: 10 (10.0.16299)
- Git Bash (mintty 3.0.6) (GNU bash, version 4.4.23(1)-release (x86_64-pc-msys))
- Node: 12.13.0
- Gulp: 4.0.2
- kss-node: 3.0.0-beta.25