So I am using pkg to create an executable of a fairly simple node/express application. I am having issues with the npm module robotjs, whenever I create my exe, it wont run because of the following error:
pkg/prelude/bootstrap.js:1740
throw error;
^
TypeError: Cannot read property '1' of null
at process.dlopen (pkg/prelude/bootstrap.js:2071:69)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1131:18)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at Module.require (pkg/prelude/bootstrap.js:1719:31)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (C:\snapshot\visortokey\node_modules\robotjs\index.js:1:77)
at Module._compile (pkg/prelude/bootstrap.js:1794:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
When I remove calls to robotjs within my project it works just fine.
I have the following in my package.json
{
"name": "project",
"bin": "src/app.js",
"version": "1.0.0",
"description": "",
"main": "src/app.js",
"scripts": {
"start": "node src/app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"pkg": {
"assets": [
"templates/**/*",
"public/**/*"
],
"targets": [
"node14"
],
"outputPath": "dist"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"hbs": "^4.1.2",
"http": "0.0.1-security",
"nodemon": "^2.0.14",
"path": "^0.12.7",
"pkg": "^5.3.3",
"robotjs": "git+https://github.com/octalmage/robotjs.git",
"socket.io": "^4.3.1"
},
"devDependencies": {}
}
When I run pkg . --debug, the final error it shows is:
[debug] prebuild-install
failed[C:\Users\Documents\visortokey\node_modules\robotjs\build\Release\robotjs.node
]:
Error: spawnSync
C:\npm\node_modules\pkg\node_modules\.bin\prebuild-install
ENOENT
Any ideas? I have tried updating the robotjs prebuild-install, adding a local resource of robotjs in my dist folder, installing robotjs from npm rather than github, adding robotjs module as an asset but whatever I do, I cannot clear the issue.