Convert Node js app to exe with nexe failed?

989 Views Asked by At

I have a node js app that runs a local server on port 8080 that delivers an index.html file. I need to convert the node js app into exe, for a one-click run. I have been trying to convert the node js app to exe with nexe module,but the created exe doesn't run and crashes. I don't know where I am doing wrong or should I try with other modules. Please guide me on this . Here are the required files and my attempts.

package.json file

  {
"name": "node-web-example",
"version": "1.0.0",
"description": "",
"main": "bundle.js",
"scripts": {
  "start": "npm run bundle-js | http-server",
  "bundle-js": "watchify main.js -o bundle.js",
  "build": "nexe -r bundle.js -r index.html -r style.css -o MyApplication-1.exe -t x86-8.0.0"
},
"author": "",
"license": "ISC",
"dependencies": {
  "dotenv": "^8.2.0",
  "uneeq-js": "^2.35.0"
},
"devDependencies": {
  "browserify": "^16.5.0",
  "nexe": "^4.0.0-beta.18",
  "watchify": "^3.11.1"
}
}

for exe build I used the command npm run build and failed

here is the error trace when the exe is run from terminal

 var n=V(105),r=V(106),i=V(83);function o(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=a.prototype:(null===e&&(e=new a(t)),e.length=t),e}function a(e,t,V){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(e,t,V);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return c(this,e,t,V)}function c(e,t,V,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,V,n){if(t.byteLength,V<0||t.byteLength<V)throw new RangeError("'offset' is out of bounds");if(t.byteLength<V+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===V&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,V):new Uint8Array(t,V,n);

ReferenceError: window is not defined
    at Module.n.__awaiter.V (D:\Uneeq Demo\examples\web\node\bundle.js:192:140642)
    at V (D:\Uneeq Demo\examples\web\node\bundle.js:170:158)
    at Object.e.exports (D:\Uneeq Demo\examples\web\node\bundle.js:185:23055)
    at V (D:\Uneeq Demo\examples\web\node\bundle.js:170:158)
    at Object.setPrototypeOf.__proto__ (D:\Uneeq Demo\examples\web\node\bundle.js:170:957)
    at Object.__dirname.2 (D:\Uneeq Demo\examples\web\node\bundle.js:170:967)
    at o (D:\Uneeq Demo\examples\web\node\bundle.js:1:327)
    at D:\Uneeq Demo\examples\web\node\bundle.js:1:378
    at Object.__dirname.1.uneeq-js (D:\Uneeq Demo\examples\web\node\bundle.js:2:22)
    at o (D:\Uneeq Demo\examples\web\node\bundle.js:1:327)

But if the use the npm start in the terminal then it runs fine from there and the webpage is openable at localhost://8080 .

here is the complete directory location

Please any help or direction is highly appreciated!!

0

There are 0 best solutions below