Pkg: 2 Problems, 1 Question

Created on 21 Jul 2019  路  5Comments  路  Source: vercel/pkg

I have a node app that works fantastically when running it with node .
But when I attempt to use pkg to make executables for Linux, Mac OS and Windows I come across 2 problems

1.

Warning Cannot resolve './modules/startup.js'
C:\Users\Casper\Documents\GitHub\Redacted\index.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.

I get that for 3 different files when doing pkg .

and in my package.json I have

"bin": "./index.js",
"pkg": {
"assets": [
"./modules//",
"./systems/
/",
"./events/*/"
]
},

2.
When launching one of the executables I get

pkg/prelude/bootstrap.js:1185
throw error;
^

Error: Timed out waiting for sync-rpc server to start (it should respond with "pong" when sent "ping"):

internal/modules/cjs/loader.js:582
throw err;
^

Error: Cannot find module 'C:\Users\Casper\Documents\GitHub\Redacted-e'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1287:46)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Function.Module.runMain (pkg/prelude/bootstrap.js:1316:12)
at startup (internal/bootstrap/node.js:320:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:659:3)

at waitForAlive (C:\Users\Casper\Documents\GitHub\Redacted\node_modules\sync-rpc\lib\index.js:80:11)
at start (C:\Users\Casper\Documents\GitHub\Redacted\node_modules\sync-rpc\lib\index.js:40:3)
at sendMessage (C:\Users\Casper\Documents\GitHub\Redacted\node_modules\sync-rpc\lib\index.js:117:17)
at createClient (C:\Users\Casper\Documents\GitHub\Redacted\node_modules\sync-rpc\lib\index.js:157:27)
at Object.<anonymous> (C:\Users\Casper\Documents\GitHub\Redacted\node_modules\sync-request\lib\index.js:16:14)
at Module._compile (internal/modules/cjs/loader.js:699:30)
at Module._compile (pkg/prelude/bootstrap.js:1222:32)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:710:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)

Any suggestions on how to solve this?
If you need more information, please reply.


And is there any way to change the icon for the windows executable?

Most helpful comment

@BitesizedLion Please, can you tell us how did you solved the issue?

All 5 comments

Solved

@BitesizedLion how did u fix it

@BitesizedLion Please, can you tell us how did you solved the issue?

@BitesizedLion how did u fix it

@BitesizedLion Please, can you tell us how did you solve the issue?

This was ages ago and I am pretty sure it was just an npm module that messed up.

Specifically sync-request

Solved

This is a horrible crime, sir

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ksmithut picture ksmithut  路  4Comments

telunc picture telunc  路  4Comments

ydubois-fr picture ydubois-fr  路  4Comments

serzhiio picture serzhiio  路  3Comments

asaf050 picture asaf050  路  3Comments