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

TypeError: shell is not a constructor #144

Open
baba20o opened this issue Nov 23, 2021 · 7 comments
Open

TypeError: shell is not a constructor #144

baba20o opened this issue Nov 23, 2021 · 7 comments

Comments

@baba20o
Copy link

baba20o commented Nov 23, 2021

Hi,

I have been trying to use node-powershell and I constantly get this error

"TypeError: shell is not a constructor"

I have installed it on multiple machines, different folders, etc and it all brings back the same error message

pserror

here is the sample code I'm using to test

var shell = require('node-powershell'); var ps = new shell({executionPolicy: 'Bypass', debugMsg: true, noProfile: true}); ps.addCommand('echo "node-powershell rocks"') .then(function(){ return ps.invoke(); }) .then(function(output){ console.log(output); ps.dispose(); }) .catch(function(err){ console.log(err); ps.dispose(); });

@cuchulopez
Copy link

Hi,
I have the same problem.

imagen

Saludos.

@cuchulopez
Copy link

I was able to fix it.
imagen

@ZTechGuy
Copy link

I'm also experiencing this issue, and the fixes previously mentioned (in this thread and in issue #16 ) are not working for me. Has anyone else found a solution?

@baba20o
Copy link
Author

baba20o commented Jul 19, 2022 via email

@rzfzr
Copy link

rzfzr commented Aug 2, 2022

@jonkindheaven what version you went back to?

@msdiniz
Copy link

msdiniz commented Nov 14, 2022

I

For me I just had to go back to an old version and it just works in that way. From: ZTechGuy @.> Sent: Tuesday, July 19, 2022 8:16 AM To: rannn505/child-shell @.> Cc: jonkindheaven @.>; Author @.> Subject: Re: [rannn505/child-shell] TypeError: shell is not a constructor (Issue #144) I'm also experiencing this issue, and the fixes previously mentioned (in this thread and in issue #16 <#16> ) are not working for me. Has anyone else found a solution? — Reply to this email directly, view it on GitHub <#144 (comment)> , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKE5C6EUMN5SV3SB4QO4TMDVU2L6FANCNFSM5IULHEMA . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AKE5C6CYU4YEPGYBMTM37E3VU2L6FA5CNFSM5IULHEMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOI3PF6YI.gif Message ID: @.*** @.***> >

Me too.
To fix, explicitly I did:

const ps = new Shell({
// error ^ TypeError: Shell is not a constructor with "node-powershell": "^5.0.1",
// FIXED !!! it works flawless with "node-powershell": "^4.0.0",

@jasonmacer
Copy link

Just as a bump on this issue...

I was running ~5.0.1 and getting the same error as everyone above. I downgraded like @msdiniz suggested and that fixed my error.

I'm guessing there is something that was changed in versions over 4.0.0.

🤷🏼‍♂️

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

No branches or pull requests

6 participants