coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.78k stars 357 forks source link

Cannot find module '@author.io/args' #308

Closed endm closed 1 year ago

endm commented 2 years ago

Hi, I could install my service, but I can´t start it

This is my error detail.

Error: Cannot find module '@author.io/args' Require stack:

coreybutler commented 2 years ago

Are you importing node-windows directly, i.e. require('node-windows')? The issue you're experiencing is one I came across in development, but only when using local references (i.e. require('../')).

endm commented 2 years ago

This is my install.js. It's the same as example.

var Service = require('node-windows').Service;
var dir = require('path').join(process.cwd(), 'app.js')

var svc = new Service({
  name:'SielconBDCasino',
  description: 'Sielcon BD Casino (MQTT Broker)',
  script: dir,
  env:{
    name: "NODE_ENV",
    value: "production"
  }
});

// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
  svc.start();
});

// Just in case this file is run twice.
svc.on('alreadyinstalled',function(){
  console.log('This service is already installed.');
});

// Listen for the "start" event and let us know when the
// process has actually started working.
svc.on('start',function(){
  console.log(svc.name+' started!');
});

// Install the script as a service.
console.log("Installing to", dir)
svc.install();
alexmarginet commented 2 years ago

I am experiencing the same issue. I could not make it work with version 1.0.0-beta.7, instead I had to force version 1.0.0-beta,6. I am not sure about this but it seems that lib/wrapper.js contains a typo when importing the Args = require('@author.io/args') . Unless I am missing something, that line should reference @author.io/arg instead

iclouden commented 2 years ago

I am experiencing the same issue. I could not make it work with version 1.0.0-beta.7, instead I had to force version 1.0.0-beta,6.

me too

bidule21 commented 2 years ago

I am experiencing the same issue. I could not make it work with version 1.0.0-beta.7, instead I had to force version 1.0.0-beta,6.

Same here

amralaa-MSFT commented 2 years ago

I am experiencing the same issue. I could not make it work with version 1.0.0-beta.7, instead I had to force version 1.0.0-beta,6.

Same

endm commented 2 years ago

Thanks!!!! I'm using V1.0.0-beta.6 now, and it's working!!!

;)

coreybutler commented 2 years ago

There is a typo in the wrapper file causing this problem... but there is also a conflict. The arg lib uses ESM-only, while this module still supports CommonJS.

I will create a CJS version of the arg lib to resolve this problem for now, but it will take me a day or two. In the meantime, I recommend using 1.0.0-beta.6 until that is complete.

I've also started a discussion to capture community feedback regarding the direction of this project. Please comment at https://github.com/coreybutler/node-windows/discussions/309#discussion-3955262.

esbenvb commented 2 years ago

Downgrading to 1.0.0-beta.6 solved it for me

lingyuj commented 2 years ago

same here

gngo2018 commented 2 years ago

Is there any update on this one lately?

coreybutler commented 2 years ago

I've been backed up with client projects. I've done part of the arg lib conversion, but am not finished yet.

RobArenzano commented 2 years ago

Hi I read that on April 6th the 1.0.0.beta.7 version should have been fixed. But I have just installed the package on a fresh VM and I still see the error 1067 issue when starting the service.

file *.err.log shows "Error: Cannot find module '@author.io/args'"

Am I missing anything?

Thanks a lot for your valuable work

ctaylor28 commented 2 years ago

Hi I read that on April 6th the 1.0.0.beta.7 version should have been fixed. But I have just installed the package on a fresh VM and I still see the error 1067 issue when starting the service.

file *.err.log shows "Error: Cannot find module '@author.io/args'"

Am I missing anything?

Thanks a lot for your valuable work

I still see the issue too, others have said beta 6 works so im downgrading and trying it now

gngo2018 commented 2 years ago

Reverting to beta 6 does work, however, shows vulnerability errors due to the optimist package dependency. Does anyone know of a workaround for the vulnerability?

RobArenzano commented 2 years ago

Reverting to beta 6 does work, however, shows vulnerability errors due to the optimist package dependency. Does anyone know of a workaround for the vulnerability?

Reverting to beta 6 works, but for auto-updating systems it requires manual intervention.

A fixed beta 7 or a fresh beta 8 would be greatly appreciated :-)

declan-wade commented 2 years ago

I am experiencing the same issue. I could not make it work with version 1.0.0-beta.7, instead I had to force version 1.0.0-beta,6.

Exact same

baconbrad commented 2 years ago

@coreybutler Would Yargs be a suitable replacement? The license is compatible.

coreybutler commented 2 years ago

@baconbrad I'm sure yargs would work, but it has a lot of dependencies. I wrote the author/arg lib (no dependencies). If another security vulnerability comes up, I can address it (unlike other libraries).

I know folks want this fixed. I want to fix it... but client work is taking precedence at the moment.

baconbrad commented 2 years ago

@coreybutler Understandable. I didn't initially realize the aim was for a dependency free parser and thought it was just to ditch a known vulnerable one.

scdba commented 2 years ago

@coreybutler - this is a fantastic project !

Just managed to get 1.0.0-beta.6 working 1.0.0-beta.7 has the Cannot find module '@author.io/args' issue

I know folks want this fixed. I want to fix it... but client work is taking precedence at the moment.

tell me about it ;)

I will wait patiently for 1.0.0-beta.8

Vimlesh22 commented 2 years ago

I am experiencing the same issue. I could not make it work with version 1.0.0-beta.7 or 1.0.0-beta.6 either.

RoYoMi commented 2 years ago

For other noobs like me looking to reinvent the same solution of rolling back to 1.0.0-beta.6 Do the the following:

cd c:\path\to\index.js
npm uninstall -g node-windows
npm install -g node-windows@1.0.0-beta.6
npm link node-windows

Then review your package.json file to ensure the correct node-windows version is listed in the dependencies section.

amoscatelli commented 2 years ago

Also, I noticed that '@author.io/args' version 1.3.22, the one used in node-windows package.json, is actually in empty folder when you install it with npm.

In other words it's missing index.js.

If you upgrade to 1.3.23 index.js can be found.

Rollbacking to beta 6 for now.

orgads commented 2 years ago

ping

Fearodin commented 1 year ago

as of july 2022 it's still an issue...

coreybutler commented 1 year ago

@Fearodin - death in the family. Please be patient.

Fearodin commented 1 year ago

@coreybutler uff sry bro, my condolences!

amoscatelli commented 1 year ago

@Fearodin - death in the family. Please be patient.

my condolences

zeeshaanali commented 1 year ago

@Fearodin - death in the family. Please be patient.

I landed to this page for obvious reason. But sorry to hear, my condolences.

VincentTungCW commented 1 year ago

For other noobs like me looking to reinvent the same solution of rolling back to 1.0.0-beta.6 Do the the following:

cd c:\path\to\index.js
npm uninstall -g node-windows
npm install -g node-windows@1.0.0-beta.6
npm link node-windows

Then review your package.json file to ensure the correct node-windows version is listed in the dependencies section.

For who trying this, just incase it not auto delete files after uninstall, before start install 1.0.0-beta.6, we can double check and manual remove at C:\Users{your_login}\AppData\Roaming\npm\node_modules\node-windows\

bsikute commented 1 year ago

For other noobs like me looking to reinvent the same solution of rolling back to 1.0.0-beta.6 Do the the following:

cd c:\path\to\index.js
npm uninstall -g node-windows
npm install -g node-windows@1.0.0-beta.6
npm link node-windows

Then review your package.json file to ensure the correct node-windows version is listed in the dependencies section.

this has worked for me. thank you

mauriciojaramillo commented 1 year ago

Hi folks.

I solved the problem changing (fixing) the path to the node-windows folder in the nnn.XML file in the bin/daemon folder.

My problem was due to join the server to the Windows Active Directory; after this action the path to the user profile is different and need to be fixed in the nnn.XML file.

I hope this help someone like me.

coreybutler commented 1 year ago

After going through the code, I decided to implement yargs in order to unblock folks. This has been released as 1.0.0-beta.8. Further comments in discussion https://github.com/coreybutler/node-windows/discussions/309.

DanielOverdevest commented 1 year ago

@coreybutler thanks for the fix in beta.8. It works for me by running this commands:

npm uninstall -g node-windows npm install -g node-windows npm link node-windows