java.io.IOException: Cannot run program "C:\Users\<username>\AppData\Roaming\npm\bunyan": CreateProcess error=193, %1 is not a valid Win32 application

When I try to run my node.js application from within IntelliJ I get the above error.  I am able to run the app from a command line without issues.  

 

"C:\Program Files\nodejs\node.exe" C:\Users\womblet\Projects\PTN\user-api\app.js
{"name":"user-api","hostname":"6YZ62N2","pid":17500,"level":30,"msg":"For API Documentation open http://127.0.0.1:10014/api-docs","time":"2019-11-14T13:50:10.434Z","v":0}
java.io.IOException: Cannot run program "C:\Users\womblet\AppData\Roaming\npm\bunyan": CreateProcess error=193, %1 is not a valid Win32 application

[ edited: stack trace removed for thread readability ]

Process finished with exit code 1

0
4 comments

do you span bunyan as a node child process? If yes, what does your code look like? Does it work if you change bunyan to bunyan.cmd?

 

> I am able to run the app from a command line without issues.  

 

does it work if you run it in Windows cmd shell?

0
Avatar
Permanently deleted user

I'm not running bunyan explicitly, just using it as a logger in my node app.  

const bunyan = require('bunyan');

const nodeEnv = process.env.NODE_ENV || 'development';
const log = bunyan.createLogger({
name: 'user-api',
streams: [
{ level: 'info', type: 'file', path: `./logs/user_api_${nodeEnv}.log` },
{ level: 'info', type: 'stream', stream: process.stderr },
],
});

module.exports = log;

0

can't reproduce using your code.

The error clearly indicates that `bunyan` is called as an executable, not required as a node.js module.

Can you share a sample project the issue can be reproduced with?

0
Avatar
Permanently deleted user

Turns out I had installed a plugin, Bunya Pretty Print, that was causing the problem.  I disabled it, and my errors went away.

1

Please sign in to leave a comment.