ember-cli-windows
ember-cli-windows copied to clipboard
Unhandled error
Hi there,
I get an error, uninstall/installed many times without much success. Here's the stack :
$ npm install ember-cli-windows -g
Z:\Users\Mic_V\AppData\Roaming\npm\ember-cli-windows -> Z:\Users\Mic_V\AppData\Roaming\npm\node_modules\ember-cli-windows\bin\ember-cli-windows
[email protected] Z:\Users\Mic_V\AppData\Roaming\npm\node_modules\ember-cli-windows
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
$ ember-cli-windows
Version: 1.3.3
Configure Windows for Ember-Cli Performace
If you continue, this tool will automate the configuration of Windows Defender and Windows Search
Confirm: Do you want to proceed? (Y/N): y
Configuring Defender
Configuring Search
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn powershell.exe ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
Any idea?
I have the most recent npm/node version. Everything is a fresh install.
Hey @villeneuve-michae, thanks for reporting! The error doesn't tell me much, but I'd love to figure out what's going on. Which version of Windows are you running?
Also, could you run this from a PowerShell with admin rights - replacing LOCATION
with the path of your ember app:
Z:\Users\Mic_V\AppData\Roaming\npm\node_modules\ember-cli-windows\setup-search.ps1 -path "LOCATION"
You'll probably still get an error, but I'd love to see what's actually failing.
I'm using windows 8.0. It doesn't look like I have "setup-search.ps1" (the folder is valid, but the file is not in it)
Ah, I found the file in a subfolder, here's the result :
# Ember-Cli-Windows-Setup
# This script configures Windows Deefender for Ember-Cli performance.
# (C) Copyright 2015 Microsoft, developed by Felix Rieseberg
# [email protected]
# ----------------------------------------------------------------------
# Usage: ./setup-defender.ps1 -path c:\mypath\*
# ----------------------------------------------------------------------
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$path
)
$tmpPath = $path
$tmpPath += "\tmp"
function Ensure-RegistryKey([string]$path)
{
# If the registry key does not exist create it
if(!(Test-Path $path)) {
New-Item $path | Out-Null
}
}
function Add-WindowsDefenderExclusionsPolicy([string]$pathToAdd)
{
$registryKey = "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions\Paths"
# Windows Defender may not have the above keys created in some cases
Ensure-RegistryKey "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender"
Ensure-RegistryKey "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions"
Ensure-RegistryKey $registryKey
$found = $False
$items = Get-Item $registryKey
Foreach ($name in $items.GetValueNames()) {
if ([string]::Compare($name, $pathToAdd, $True) -eq 0) {
# Path already added
Write-Host "Path already added to exclusion list"
return
}
}
Set-ItemProperty -Path $registryKey -Name $pathToAdd -Value 0 -Force
Write-Host "Path added to defender exclusion list, updating policy"
gpupdate | Out-Null
}
function IsAdministrator
{
$Identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$Principal = New-Object System.Security.Principal.WindowsPrincipal($Identity)
$Principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
}
function IsUacEnabled
{
(Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System).EnableLua -ne 0
}
#
# Self-Elevate
#
if (!(IsAdministrator))
{
if (IsUacEnabled)
{
[string[]]$argList = @('-NoProfile', '-NoExit', '-File', $MyInvocation.MyCommand.Path)
$argList += $MyInvocation.BoundParameters.GetEnumerator() | Foreach {"-$($_.Key)", "$($_.Value)"}
$argList += $MyInvocation.UnboundArguments
Start-Process PowerShell.exe -Verb Runas -WorkingDirectory $pwd -ArgumentList $argList
return
}
else
{
throw "You must be administrator to run this script"
}
}
# Set preference
"Removing " + $path + " from Windows Defender's Eye"
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx
$version = [Environment]::OSVersion.Version
if (($version.Major -eq 6 -AND $version.Minor -gt 1) -or ($version.Major -gt 6)) {
# Windows 8 and above
if (Get-Command Set-MpPreference -errorAction SilentlyContinue) {
Set-MpPreference -ExclusionPath $path
} else {
"Defender Configuration not available, fallback required"
}
}
elseif ($version.Major -eq 6 -AND $version.Minor -eq 1) {
# Windows 7 / Server 2008 R2
Add-WindowsDefenderExclusionsPolicy $path
}
"Done"
EDIT: Oh wait, for some reason I think it simply opened the file. Nothing was output in the powershell.