child-shell: node-powershell was unable to start powershell
I’m adding a feature to Atom Beautify to support formatting PowerShell files/text using PowerShell Beautifier. I came across this package to be able to run the PowerShell module needed for this to happen, however I’m running into this error: Opss... node-powershell was unable to start PowerShell. Please make sure that PowerShell is installed properly on your system, and try again., and a separate message: 'powershell' could not be spawned. Is it installed and on your path? If so please open an issue on the package spawning the process. I’m on a Mac and have installed PowerShell via Homebrew. Atom-Beautify is currently written in CoffeeScript, so the syntax is a little different but here is my code. The relevant part is in the beautify function where it errors out on ps = new shell(). It’s all WIP (and just started)
"use strict"
Beautifier = require('./beautifier')
shell = require('node-powershell')
module.exports = class PowerShellBeautifier extends Beautifier
name: "powershell-beautifier"
link: "https://github.com/DTW-DanWard/PowerShell-Beautifier"
options: {
PowerShell: false
}
beautify: (text, language, options) ->
ps = new shell()
tempFile = @tempFile("input", text)
ps.addCommand("Set-PSRepository -Name PSGallery -InstallationPolicy Trusted")
ps.addCommand("Install-Module -Name PowerShell-Beautifier")
ps.addCommand("Edit-DTWBeautifyScript " + tempFile)
ps.invoke().then(=> @readFile(tempFile)).catch(err => {})
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (1 by maintainers)
Commits related to this issue
- fix #37, fix #39 fix #44, fix #47, fix #54, fix #72, fix #64 — committed to rannn505/child-shell by rannn505 5 years ago
@rannn505 Please can you merge this PR, cause everything works great except that.
Thanks 😃
don’t forget you need to pass a parameter to use PowerShell Core “pwsh”
Can you try my fork and then report back to us if it meets your needs?
https://github.com/BenjaminMichael/node-powershell