Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using log4js with nexe #1039

Open
hgleam opened this issue Mar 18, 2023 · 1 comment
Open

Using log4js with nexe #1039

hgleam opened this issue Mar 18, 2023 · 1 comment
Labels

Comments

@hgleam
Copy link

hgleam commented Mar 18, 2023

What happened:
Error: Cannot find module 'flatted

What you expected to happen:
No errors

How to reproduce it (as minimally and precisely as possible):
source man.ts

import Log4js from 'log4js';
require('log4js/lib/appenders/file')
require('log4js/lib/appenders/stdout')
Log4js.configure({
    appenders:{ startBroker:{type:'file',filename:'Mosca.log'}},
    categories:{default:{appenders:['startBroker'],level:'info'}}
});
let logger = Log4js.getLogger('start apps');
logger.info('hello apps');

compile

tsc

build

nexe main.js -t windows-x64-14.15.3

Preparation for distribution

Move the executable file to another directory for distribution

Before moving:/c/Users/xxxx/Desktop/aaaa/log4js-test
After moving:C:\Users\xxxx\Desktop\program\app

Anything else we need to know?:
Nothing.

Environment:

  • Platform(OS/Version):Windows 10 Pro 64bit
  • Nexe version:4.0.0-rc.2
@hgleam hgleam added the bug label Mar 18, 2023
@bruce-one
Copy link
Contributor

It's working correctly here on Linux using 4.0.0-rc.2, so not sure what the issue is unfortunately :-/

It might be worth trying a npm ci and a nexe --clean before trying again?

Something that might help debugging would be setting DEBUG='nexe:require' as an environment variable, as then nexe will log attempts to find the relevant modules, e.g.

$ DEBUG='nexe:require' ./log4js-test 2>&1|grep flatted
...
[nexe] - read     (hit)              .../node_modules/flatted/package.json
[nexe] - stat     (hit)              .../node_modules/flatted/cjs/index.js   0
[nexe] - read     (hit)              .../node_modules/flatted/cjs/package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants