EmbeddedEnterprises / cmake-ts

Typescript based rewrite of cmake-js to support cross compilation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error generated if make is not present due to wrong usage of 'which'

robinchrist opened this issue · comments

Native builds on Windows fail, because of wrong usage of which if make is not present

> Distribution File Download... C:\devspace\node-corelib\node_modules\which\which.js:10
  Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
                ^

Error: not found: make
    at getNotFoundError (C:\devspace\node-corelib\node_modules\which\which.js:10:17)
    at C:\devspace\node-corelib\node_modules\which\which.js:57:18
    at new Promise (<anonymous>)
    at step (C:\devspace\node-corelib\node_modules\which\which.js:54:21)
    at C:\devspace\node-corelib\node_modules\which\which.js:71:22
    at new Promise (<anonymous>)
    at subStep (C:\devspace\node-corelib\node_modules\which\which.js:69:33)
    at C:\devspace\node-corelib\node_modules\which\which.js:80:22
    at C:\devspace\node-corelib\node_modules\isexe\index.js:42:5
    at C:\devspace\node-corelib\node_modules\isexe\windows.js:36:5
    at FSReqCallback.oncomplete (node:fs:198:21) {
  code: 'ENOENT'
}

The issue is in lib.ts here:

cmake-ts/src/lib.ts

Lines 144 to 154 in 553a035

const cmake = await which('cmake');
if (!cmake) {
console.error('cmake binary not found, try to specify \'cmakeToUse\'');
process.exit(1);
}
configs.cmakeToUse = cmake;
}
// handle missing generator
const ninjaP = which('ninja');
const makeP = which('make');

which throws an Error if the specified tool could not be found, hence the issue

fixed in 0.2.1