Skip to content

Error: Unable to find makensis executable #39

@GameTec-live

Description

@GameTec-live

All of the sudden makensis-action fails in github actions with "Error: Unable to find makensis executable".
Upgrading to v5.0 did not resolve the issue.
See run:
https://github.com/GameTec-live/ChameleonUltraGUI/actions/runs/17927222649/job/50976240996

file:///D:/a/_actions/joncloud/makensis-action/v5.0/dist/index.js:1
import{constants as e,existsSync as t}from"fs";import{access as n,copyFile as r,mkdir as i,readdir as a,stat as o}from"fs/promises";import{basename as s,join as c,resolve as l}from"path";import{promisify as u}from"util";import{exec as d}from"child_process";import{env as f,platform as p}from"process";const m=()=>{let e=m.coreGetInput(`arguments`),t=m.coreGetInput(`additional-plugin-paths`).split(/\n|\r/).map(e=>e.trim()).filter(e=>!!e),n=m.coreGetInput(`script-file`);return{customArguments:e,additionalPluginPaths:t,scriptFile:n}};m.coreGetInput=function(e){return(process.env[`INPUT_${e.replace(/ /g,`_`).toUpperCase()}`]||``).trim()};const h=e=>{h.setFailed(e||h.genericErrorMessage)};h.setFailed=function(e){e instanceof Error&&(e=e.toString()),process.exitCode=1,process.stdout.write(`error${g(e)}${os.EOL}`)};function g(e){return toCommandValue(e).replace(/%/g,`%25`).replace(/\r/g,`%0D`).replace(/\n/g,`%0A`)}h.genericErrorMessage=`Unexpected error occurred`;const _=u(d),v=e=>{let n=e.filter(t);return n.length?n[0]:``},y=()=>{let e=f.PATH.split(`;`).concat([c(`C:`,`Program Files (x86)`,`NSIS`)]).map(e=>c(e,`makensis.exe`));return v(e)},b=()=>{let e=f.PATH.split(`:`).concat([`/usr/local/bin`,`/usr/bin`,`/opt/local/bin`]).map(e=>c(e,`makensis`));return v(e)};var x=class{constructor(e){if(!e||!t(e))throw Error(`Unable to find makensis executable`);this.path=e}async execAsync(e){return(await _(`"${this.path}" ${e}`)).stdout}async getSymbolsAsync(){let e=await this.execAsync(`-HDRINFO`),t=/Defined symbols: (.*)/g.exec(e.toString(`utf-8`));if(!t||!t.length||t.length<2)throw Error(`Unable to get symbols`);let n={};return t[1].split(`,`).forEach(e=>{let t=e.indexOf(`=`);if(t===-1)n[e]=``;else{let r=e.substr(0,t);n[r]=e.substr(t+1)}}),n}};const S=p===`win32`?y():b();var C=new x(S);const{F_OK:w}=e,T=async e=>(await o(e)).isDirectory(),E=async e=>{try{await n(e,w)}catch(e){return!1}return!0},D=async(e,t)=>{console.log(`copyDirectory`,e,t),await E(t)||await i(t);let n=(await a(e)).map(async n=>{let i=s(n),a=c(e,i);await T(a)?await D(a,c(t,i)):(console.log(`copying`,a,c(t,i)),await r(a,c(t,i)))});await Promise.all(n)};var O=class{constructor(e){this.debugMode=e,this.pluginPaths=[],this.customArguments=``}debugLog(e){this.debugMode&&console.log(e)}getCustomArguments(){return this.customArguments}setCustomArguments(e){this.debugLog(`Settings arguments: ${e}`),this.customArguments=e}addPluginPath(e){this.debugLog(`Adding plugin path: ${e}`),this.pluginPaths.push(e)}getProcessArguments(e){let t=[];return this.customArguments.indexOf(`/V`)===-1&&this.customArguments.indexOf(`-V`)===-1&&(this.debugMode?t.push(`-V4`):t.push(`-V1`)),t.push(this.customArguments),t.push(`"${l(e)}"`),t}async createInstallerAsync(e){if(console.log(`Creating installer for: ${e}`),this.pluginPaths.length){let e=(await C.getSymbolsAsync()).NSISDIR;if(!e)throw Error(`Unable to determine NSISDIR. Check makensis -HDRINFO output`);let t=c(e,`Plugins`);this.debugLog(`Using system Plugins path ${t}`);let n=this.pluginPaths.map(e=>(console.log(`Including plugin path`,e),D(e,t)));await Promise.all(n)}let t=this.getProcessArguments(e).join(` `);this.debugLog(`Running ${t}`),await C.execAsync(t)}};const k=e=>{if(!e)return!1;if(e!==`true`&&e!==`false`)throw Error(`Input must be boolean value 'true' or 'false' but got '${e}'`);return e===`true`};(async()=>{try{let e=k(process.env.debug),{customArguments:t,additionalPluginPaths:n,scriptFile:r}=m(),i=new O(e);i.setCustomArguments(t),n.forEach(e=>i.addPluginPath(e.trim())),await i.createInstallerAsync(r)}catch(e){h(e.message)}})().then(()=>process.exit(0)).catch(()=>process.exit(1));export{};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Unable to find makensis executable
    at new x (file:///D:/a/_actions/joncloud/makensis-action/v5.0/dist/index.js:1:1320)
    at file:///D:/a/_actions/joncloud/makensis-action/v5.0/dist/index.js:1:1791
    at ModuleJob.run (node:internal/modules/esm/module_job:371:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:669:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions