node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

`Find-VisualStudio.cs` throws System.AccessViolationException

Open seokju-na opened this issue 3 years ago • 5 comments

  • Node Version: 16.8.0, 7.22.0
  • Platform: windows
  • Compiler:
  • Module:
Verbose output (from npm or node-gyp):
처리되지 않은 예외: System.AccessViolationException: 보호된 메모리를 읽거나 쓰려고 했습니다. 대부분 이러한 경우는 다른 메모리가 손상되었음을 나타냅니다.
   위치: System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, Boolean fSkipIntegrityCheck, SecurityContextSource securityContextSource)
   위치: System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)
   위치: Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
   위치: Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames)
   위치: Microsoft.PowerShell.Commands.AddTypeCommand.CompileAssemblyFromSource(List`1 generatedTypes)
   위치: Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
   위치: System.Management.Automation.CommandProcessorBase.Complete()
   위치: System.Management.Automation.CommandProcessorBase.DoComplete()
   위치: System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)
   위치: System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
   위치: System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
   위치: System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
   위치: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   위치: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   위치: System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   위치: System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   위치: System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   위치: System.Management.Automation.DlrScriptCommandProcessor.Complete()
   위치: System.Management.Automation.CommandProcessorBase.DoComplete()
   위치: System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)
   위치: System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
   위치: System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
   위치: System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
   위치: System.Management.Automation.Runspaces.PipelineThread.WorkerProc()
   위치: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   위치: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   위치: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   위치: System.Threading.ThreadHelper.ThreadStart()

Installed visual studio Build Tools 2017

Got System.AccessViolationException error when find-visualstudio.js executed.

Can be reproduced wtih below command:

powershell -ExecutionPolicy Unrestricted -Command "Add-Type -Path ./node_modules/node-gyp/lib/Find-VisualStudio.cs; [VisualStudioConfiguration.Main]::PrintJson()"

I have no knowledge of the windows platform, guess, could this problem be caused by a security program which blocks access?

If it's a possible cause, which part should i grant access to?

seokju-na avatar Sep 06 '21 11:09 seokju-na

Please provide the full error log.

cclauss avatar Sep 06 '21 11:09 cclauss

@cclauss

Reproduce steps:

package.json

{
  "dependencies": {
    "node-gyp": "^8.2.0"
  }
}

run cli:

npm install // install node-gyp locally

npm config set msvs_version 2017
npm install ffi --loglevel=silly
full log
npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Users\\seokju.me\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'install',
npm verb cli   'ffi',
npm verb cli   '--loglevel',
npm verb cli   'silly'
npm verb cli ]
npm info using [email protected]
npm info using [email protected]
npm timing npm:load:whichnode Completed in 0ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:C:\Users\seokju.me\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 2ms
npm timing config:load:builtin Completed in 3ms
npm timing config:load:cli Completed in 1ms
npm timing config:load:env Completed in 1ms
npm timing config:load:file:C:\Users\seokju.me\playgrounds\hello-ffi\.npmrc Completed in 1ms
npm timing config:load:project Completed in 1ms
npm timing config:load:file:C:\Users\seokju.me\.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:C:\Users\seokju.me\AppData\Roaming\npm\etc\npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 0ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 10ms
npm timing npm:load:configload Completed in 10ms
npm timing npm:load:setTitle Completed in 0ms
npm timing npm:load:setupLog Completed in 0ms
npm timing config:load:flatten Completed in 2ms
npm timing npm:load:cleanupLog Completed in 1ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load:projectScope Completed in 1ms
npm timing npm:load Completed in 25ms
npm timing arborist:ctor Completed in 0ms
npm timing idealTree:init Completed in 67ms
npm timing idealTree:userRequests Completed in 1ms
npm sill idealTree buildDeps
npm sill fetch manifest ffi@*
npm verb shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules
npm http fetch GET 200 https://registry.npmjs.org/ffi 67ms (cache hit)
npm sill placeDep ROOT [email protected] OK for:  want: *
npm sill fetch manifest bindings@~1.2.0
npm sill fetch manifest debug@2
npm sill fetch manifest ref@1
npm sill fetch manifest ref-struct@1
npm sill fetch manifest nan@2
npm http fetch GET 200 https://registry.npmjs.org/ref-struct 15ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/debug 18ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/bindings 23ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/ref 23ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/nan 24ms (cache hit)
npm timing idealTree:#root Completed in 103ms
npm sill placeDep ROOT [email protected] OK for: [email protected] want: ~1.2.0
npm sill placeDep ROOT [email protected] OK for: [email protected] want: 2
npm sill placeDep ROOT [email protected] OK for: [email protected] want: 2
npm sill placeDep ROOT [email protected] OK for: [email protected] want: 1
npm sill placeDep ROOT [email protected] OK for: [email protected] want: 1
npm sill fetch manifest [email protected]
npm http fetch GET 200 https://registry.npmjs.org/ms 7ms (cache hit)
npm timing idealTree:node_modules/ffi Completed in 17ms
npm timing idealTree:node_modules/bindings Completed in 0ms
npm sill placeDep ROOT [email protected] OK for: [email protected] want: 2.0.0
npm timing idealTree:node_modules/debug Completed in 2ms
npm timing idealTree:node_modules/ms Completed in 0ms
npm timing idealTree:node_modules/nan Completed in 0ms
npm timing idealTree:node_modules/ref Completed in 0ms
npm timing idealTree:node_modules/ref-struct Completed in 0ms
npm timing idealTree:buildDeps Completed in 128ms
npm timing idealTree:fixDepFlags Completed in 1ms
npm timing idealTree Completed in 200ms
npm timing reify:loadTrees Completed in 201ms
npm timing reify:diffTrees Completed in 9ms
npm sill reify moves {}
npm timing reify:retireShallow Completed in 1ms
npm timing reify:createSparse Completed in 3ms
npm timing reify:loadBundles Completed in 0ms
npm sill audit bulk request {
npm sill audit   abbrev: [ '1.1.1' ],
npm sill audit   ajv: [ '6.12.6' ],
npm sill audit   'ansi-regex': [ '2.1.1' ],
npm sill audit   aproba: [ '1.2.0' ],
npm sill audit   'are-we-there-yet': [ '1.1.7' ],
npm sill audit   asn1: [ '0.2.4' ],
npm sill audit   'assert-plus': [ '1.0.0' ],
npm sill audit   asynckit: [ '0.4.0' ],
npm sill audit   'aws-sign2': [ '0.7.0' ],
npm sill audit   aws4: [ '1.11.0' ],
npm sill audit   'balanced-match': [ '1.0.2' ],
npm sill audit   'bcrypt-pbkdf': [ '1.0.2' ],
npm sill audit   'brace-expansion': [ '1.1.11' ],
npm sill audit   caseless: [ '0.12.0' ],
npm sill audit   chownr: [ '2.0.0' ],
npm sill audit   'code-point-at': [ '1.1.0' ],
npm sill audit   'combined-stream': [ '1.0.8' ],
npm sill audit   'concat-map': [ '0.0.1' ],
npm sill audit   'console-control-strings': [ '1.1.0' ],
npm sill audit   'core-util-is': [ '1.0.3', '1.0.2' ],
npm sill audit   dashdash: [ '1.14.1' ],
npm sill audit   'delayed-stream': [ '1.0.0' ],
npm sill audit   delegates: [ '1.0.0' ],
npm sill audit   'ecc-jsbn': [ '0.1.2' ],
npm sill audit   'env-paths': [ '2.2.1' ],
npm sill audit   extend: [ '3.0.2' ],
npm sill audit   extsprintf: [ '1.3.0' ],
npm sill audit   'fast-deep-equal': [ '3.1.3' ],
npm sill audit   'fast-json-stable-stringify': [ '2.1.0' ],
npm sill audit   'forever-agent': [ '0.6.1' ],
npm sill audit   'form-data': [ '2.3.3' ],
npm sill audit   'fs-minipass': [ '2.1.0' ],
npm sill audit   'fs.realpath': [ '1.0.0' ],
npm sill audit   gauge: [ '2.7.4' ],
npm sill audit   getpass: [ '0.1.7' ],
npm sill audit   glob: [ '7.1.7' ],
npm sill audit   'graceful-fs': [ '4.2.8' ],
npm sill audit   'har-schema': [ '2.0.0' ],
npm sill audit   'har-validator': [ '5.1.5' ],
npm sill audit   'has-unicode': [ '2.0.1' ],
npm sill audit   'http-signature': [ '1.2.0' ],
npm sill audit   inflight: [ '1.0.6' ],
npm sill audit   inherits: [ '2.0.4' ],
npm sill audit   'is-fullwidth-code-point': [ '1.0.0' ],
npm sill audit   'is-typedarray': [ '1.0.0' ],
npm sill audit   isarray: [ '1.0.0' ],
npm sill audit   isexe: [ '2.0.0' ],
npm sill audit   isstream: [ '0.1.2' ],
npm sill audit   jsbn: [ '0.1.1' ],
npm sill audit   'json-schema': [ '0.2.3' ],
npm sill audit   'json-schema-traverse': [ '0.4.1' ],
npm sill audit   'json-stringify-safe': [ '5.0.1' ],
npm sill audit   jsprim: [ '1.4.1' ],
npm sill audit   'lru-cache': [ '6.0.0' ],
npm sill audit   'mime-db': [ '1.49.0' ],
npm sill audit   'mime-types': [ '2.1.32' ],
npm sill audit   minimatch: [ '3.0.4' ],
npm sill audit   minipass: [ '3.1.3' ],
npm sill audit   minizlib: [ '2.1.2' ],
npm sill audit   mkdirp: [ '1.0.4' ],
npm sill audit   'node-gyp': [ '7.1.2' ],
npm sill audit   nopt: [ '5.0.0' ],
npm sill audit   npmlog: [ '4.1.2' ],
npm sill audit   'number-is-nan': [ '1.0.1' ],
npm sill audit   'oauth-sign': [ '0.9.0' ],
npm sill audit   'object-assign': [ '4.1.1' ],
npm sill audit   once: [ '1.4.0' ],
npm sill audit   'path-is-absolute': [ '1.0.1' ],
npm sill audit   'performance-now': [ '2.1.0' ],
npm sill audit   'process-nextick-args': [ '2.0.1' ],
npm sill audit   psl: [ '1.8.0' ],
npm sill audit   punycode: [ '2.1.1' ],
npm sill audit   qs: [ '6.5.2' ],
npm sill audit   'readable-stream': [ '2.3.7' ],
npm sill audit   request: [ '2.88.2' ],
npm sill audit   rimraf: [ '3.0.2' ],
npm sill audit   'safe-buffer': [ '5.1.2' ],
npm sill audit   'safer-buffer': [ '2.1.2' ],
npm sill audit   semver: [ '7.3.5' ],
npm sill audit   'set-blocking': [ '2.0.0' ],
npm sill audit   'signal-exit': [ '3.0.3' ],
npm sill audit   sshpk: [ '1.16.1' ],
npm sill audit   string_decoder: [ '1.1.1' ],
npm sill audit   'string-width': [ '1.0.2' ],
npm sill audit   'strip-ansi': [ '3.0.1' ],
npm sill audit   tar: [ '6.1.11' ],
npm sill audit   'tough-cookie': [ '2.5.0' ],
npm sill audit   'tunnel-agent': [ '0.6.0' ],
npm sill audit   tweetnacl: [ '0.14.5' ],
npm sill audit   'uri-js': [ '4.4.1' ],
npm sill audit   'util-deprecate': [ '1.0.2' ],
npm sill audit   uuid: [ '3.4.0' ],
npm sill audit   verror: [ '1.10.0' ],
npm sill audit   which: [ '2.0.2' ],
npm sill audit   'wide-align': [ '1.1.3' ],
npm sill audit   wrappy: [ '1.0.2' ],
npm sill audit   yallist: [ '4.0.0' ],
npm sill audit   ffi: [ '2.3.0' ],
npm sill audit   bindings: [ '1.2.1' ],
npm sill audit   debug: [ '2.6.9' ],
npm sill audit   nan: [ '2.15.0' ],
npm sill audit   ref: [ '1.3.5' ],
npm sill audit   'ref-struct': [ '1.1.0' ],
npm sill audit   ms: [ '2.0.0' ]
npm sill audit }
npm timing reifyNode:node_modules/bindings Completed in 113ms
npm timing reifyNode:node_modules/ms Completed in 118ms
npm timing reifyNode:node_modules/ref-struct Completed in 148ms
npm timing reifyNode:node_modules/nan Completed in 230ms
npm timing reifyNode:node_modules/debug Completed in 279ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 296ms
npm timing auditReport:getReport Completed in 677ms
npm sill audit report {}
npm timing auditReport:init Completed in 0ms
npm timing reify:audit Completed in 678ms
npm timing reifyNode:node_modules/ref Completed in 664ms
npm timing reifyNode:node_modules/ffi Completed in 1935ms
npm timing reify:unpack Completed in 1937ms
npm timing reify:unretire Completed in 0ms
npm timing build:queue Completed in 2ms
npm info run [email protected] install node_modules/ffi node-gyp rebuild
npm info run [email protected] install node_modules/ref node-gyp rebuild
npm info run [email protected] install { code: 1, signal: null }
npm info run [email protected] install { code: 1, signal: null }
npm timing reify:rollback:createSparse Completed in 201ms
npm timing reify:rollback:retireShallow Completed in 0ms
npm timing command:install Completed in 26834ms
npm verb stack Error: command failed
npm verb stack     at ChildProcess.<anonymous> (C:\Users\seokju.me\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
npm verb stack     at ChildProcess.emit (node:events:394:28)
npm verb stack     at maybeClose (node:internal/child_process:1064:16)
npm verb stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm verb pkgid [email protected]
npm verb cwd C:\Users\seokju.me\playgrounds\hello-ffi
npm verb Windows_NT 10.0.19042
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\seokju.me\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "ffi" "--loglevel" "silly"
npm verb node v16.8.0
npm verb npm  v7.22.0
npm ERR! code 1
npm ERR! path C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\ref
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Users\\seokju.me\\playgrounds\\hello-ffi\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild'
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp sill find Python runChecks: err = undefined
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp sill find Python runChecks: err = undefined
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp sill find Python runChecks: err = undefined
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp sill find Python execFile: exec = "\"python3\""
npm ERR! gyp sill find Python execFile: args = ["\"-c\"","\"import sys; print(sys.executable);\""]
npm ERR! gyp sill find Python execFile: opts = <HIDDEN>
npm ERR! gyp sill find Python execFile result: err = null
npm ERR! gyp sill find Python execFile result: stdout = "C:\\Users\\seokju.me\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\python.exe\r\n"
npm ERR! gyp sill find Python execFile result: stderr = ""
npm ERR! gyp verb find Python - executable path is "C:\Users\seokju.me\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe"
npm ERR! gyp verb find Python - executing "C:\Users\seokju.me\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe" to get version
npm ERR! gyp sill find Python execFile: exec = "C:\\Users\\seokju.me\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\python.exe"
npm ERR! gyp sill find Python execFile: args = ["-c","import sys; print(\"%s.%s.%s\" % sys.version_info[:3]);"]
npm ERR! gyp sill find Python execFile: opts = <HIDDEN>
npm ERR! gyp sill find Python execFile result: err = null
npm ERR! gyp sill find Python execFile result: stdout = "3.9.7\r\n"
npm ERR! gyp sill find Python execFile result: stderr = ""
npm ERR! gyp verb find Python - version is "3.9.7"
npm ERR! gyp info find Python using Python version 3.9.7 found at "C:\Users\seokju.me\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.8.0
npm ERR! gyp verb command install [ '16.8.0' ]
npm ERR! gyp verb install input version string "16.8.0"
npm ERR! gyp verb install installing version: 16.8.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.8.0
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\ref\build
npm ERR! gyp verb build dir "build" dir needed to be created? C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\ref\build
npm ERR! gyp verb find VS msvs_version was set from command line or npm config
npm ERR! gyp verb find VS - looking for Visual Studio version 2017
npm ERR! gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp sill find VS Running C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe [
npm ERR! gyp sill find VS   '-ExecutionPolicy',
npm ERR! gyp sill find VS   'Unrestricted',
npm ERR! gyp sill find VS   '-NoProfile',
npm ERR! gyp sill find VS   '-Command',
npm ERR! gyp sill find VS   "&{Add-Type -Path 'C:\\Users\\seokju.me\\playgrounds\\hello-ffi\\node_modules\\node-gyp\\lib\\Find-VisualStudio.cs';[VisualStudioConfiguration.Main]::PrintJson()}"
npm ERR! gyp sill find VS ]
npm ERR! gyp sill find VS PS stderr = "\nó������ ���� ����: System.AccessViolationException: ��ȣ�� �޸𸮸� �аų� ������ �߽��ϴ�. ��κ� �̷��� ���� �ٸ� �޸𸮰� �ջ�Ǿ����� ��Ÿ���ϴ�.\r\n   ��ġ: System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, Boolean fSkipIntegrityCheck, SecurityContextSource securityContextSource)\r\n   ��ġ: System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)\r\n   ��ġ: Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)\r\n   ��ġ: Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames)\r\n   ��ġ: Microsoft.PowerShell.Commands.AddTypeCommand.CompileAssemblyFromSource(List`1 generatedTypes)\r\n   ��ġ: Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()\r\n   ��ġ: System.Management.Automation.CommandProcessorBase.Complete()\r\n   ��ġ: System.Management.Automation.CommandProcessorBase.DoComplete()\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)\r\n   ��ġ: System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)\r\n   ��ġ: System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)\r\n   ��ġ: System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)\r\n   ��ġ: System.Management.Automation.DlrScriptCommandProcessor.Complete()\r\n   ��ġ: System.Management.Automation.CommandProcessorBase.DoComplete()\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)\r\n   ��ġ: System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)\r\n   ��ġ: System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)\r\n   ��ġ: System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)\r\n   ��ġ: System.Management.Automation.DlrScriptCommandProcessor.Complete()\r\n   ��ġ: System.Management.Automation.CommandProcessorBase.DoComplete()\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)\r\n   ��ġ: System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()\r\n   ��ġ: System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()\r\n   ��ġ: System.Management.Automation.Runspaces.PipelineThread.WorkerProc()\r\n   ��ġ: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   ��ġ: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   ��ġ: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   ��ġ: System.Threading.ThreadHelper.ThreadStart()\n"
npm ERR! gyp sill find VS PS err = "Error: Command failed: C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Unrestricted -NoProfile -Command &{Add-Type -Path 'C:\\Users\\seokju.me\\playgrounds\\hello-ffi\\node_modules\\node-gyp\\lib\\Find-VisualStudio.cs';[VisualStudioConfiguration.Main]::PrintJson()}\n\nó������ ���� ����: System.AccessViolationException: ��ȣ�� �޸𸮸� �аų� ������ �߽��ϴ�. ��κ� �̷��� ���� �ٸ� �޸𸮰� �ջ�Ǿ����� ��Ÿ���ϴ�.\r\n   ��ġ: System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, Boolean fSkipIntegrityCheck, SecurityContextSource securityContextSource)\r\n   ��ġ: System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)\r\n   ��ġ: Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)\r\n   ��ġ: Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames)\r\n   ��ġ: Microsoft.PowerShell.Commands.AddTypeCommand.CompileAssemblyFromSource(List`1 generatedTypes)\r\n   ��ġ: Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()\r\n   ��ġ: System.Management.Automation.CommandProcessorBase.Complete()\r\n   ��ġ: System.Management.Automation.CommandProcessorBase.DoComplete()\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)\r\n   ��ġ: System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)\r\n   ��ġ: System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)\r\n   ��ġ: System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)\r\n   ��ġ: System.Management.Automation.DlrScriptCommandProcessor.Complete()\r\n   ��ġ: System.Management.Automation.CommandProcessorBase.DoComplete()\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)\r\n   ��ġ: System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)\r\n   ��ġ: System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n   ��ġ: System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)\r\n   ��ġ: System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)\r\n   ��ġ: System.Management.Automation.DlrScriptCommandProcessor.Complete()\r\n   ��ġ: System.Management.Automation.CommandProcessorBase.DoComplete()\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)\r\n   ��ġ: System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)\r\n   ��ġ: System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()\r\n   ��ġ: System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()\r\n   ��ġ: System.Management.Automation.Runspaces.PipelineThread.WorkerProc()\r\n   ��ġ: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   ��ġ: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   ��ġ: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   ��ġ: System.Threading.ThreadHelper.ThreadStart()\n\n    at ChildProcess.exithandler (node:child_process:397:12)\n    at ChildProcess.emit (node:events:394:28)\n    at maybeClose (node:internal/child_process:1064:16)\n    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)"
npm ERR! gyp verb find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp verb find VS looking for Visual Studio 2015
npm ERR! gyp sill reg-search looking for "14.0" in "HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7"
npm ERR! gyp sill reg running C:\WINDOWS\System32\reg.exe [
npm ERR! gyp sill reg   'query',
npm ERR! gyp sill reg   'HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7',
npm ERR! gyp sill reg   '/v',
npm ERR! gyp sill reg   '14.0'
npm ERR! gyp sill reg ]
npm ERR! gyp sill reg reg.exe stdout = ""
npm ERR! gyp sill reg reg.exe err = "Error: Command failed: C:\\WINDOWS\\System32\\reg.exe query HKLM\\Software\\Microsoft\\VisualStudio\\SxS\\VC7 /v 14.0\n����: ����: �ý����� ������ ������Ʈ�� Ű �Ǵ� ���� ã�� �� �����ϴ�.\r\n\n    at ChildProcess.exithandler (node:child_process:397:12)\n    at ChildProcess.emit (node:events:394:28)\n    at maybeClose (node:internal/child_process:1064:16)\n    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)"
npm ERR! gyp sill reg reg.exe stderr = "����: ����: �ý����� ������ ������Ʈ�� Ű �Ǵ� ���� ã�� �� �����ϴ�.\r\n"
npm ERR! gyp sill reg-search looking for "14.0" in "HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7"
npm ERR! gyp sill reg running C:\WINDOWS\System32\reg.exe [
npm ERR! gyp sill reg   'query',
npm ERR! gyp sill reg   'HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7',
npm ERR! gyp sill reg   '/v',
npm ERR! gyp sill reg   '14.0'
npm ERR! gyp sill reg ]
npm ERR! gyp sill reg reg.exe stdout = "\r\nHKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\r\n    14.0    REG_SZ    C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\\r\n\r\n"
npm ERR! gyp sill reg found: "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\"
npm ERR! gyp verb find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
npm ERR! gyp sill reg-search looking for "MSBuildToolsPath" in "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions\\14.0"
npm ERR! gyp sill reg running C:\WINDOWS\System32\reg.exe [
npm ERR! gyp sill reg   'query',
npm ERR! gyp sill reg   'HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions\\14.0',
npm ERR! gyp sill reg   '/v',
npm ERR! gyp sill reg   'MSBuildToolsPath',
npm ERR! gyp sill reg   '/reg:32'
npm ERR! gyp sill reg ]
npm ERR! gyp sill reg reg.exe stdout = ""
npm ERR! gyp sill reg reg.exe err = "Error: Command failed: C:\\WINDOWS\\System32\\reg.exe query HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions\\14.0 /v MSBuildToolsPath /reg:32\n����: ����: �ý����� ������ ������Ʈ�� Ű �Ǵ� ���� ã�� �� �����ϴ�.\r\n\n    at ChildProcess.exithandler (node:child_process:397:12)\n    at ChildProcess.emit (node:events:394:28)\n    at maybeClose (node:internal/child_process:1064:16)\n    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)"
npm ERR! gyp sill reg reg.exe stderr = "����: ����: �ý����� ������ ������Ʈ�� Ű �Ǵ� ���� ã�� �� �����ϴ�.\r\n"
npm ERR! gyp verb find VS - could not find MSBuild in registry for this version
npm ERR! gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
npm ERR! gyp ERR! find VS - looking for Visual Studio version 2017
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
npm ERR! gyp ERR! find VS - could not find MSBuild in registry for this version
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS valid versions for msvs_version:
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\node-gyp\lib\find-visualstudio.js:384:20
npm ERR! gyp ERR! stack     at C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:404:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\seokju.me\\playgrounds\\hello-ffi\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\seokju.me\playgrounds\hello-ffi\node_modules\ref
npm ERR! gyp ERR! node -v v16.8.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm verb exit 1
npm timing npm Completed in 28000ms
npm verb unfinished npm timer reify 1630936575998
npm verb unfinished npm timer reify:build 1630936578551
npm verb unfinished npm timer build 1630936578551
npm verb unfinished npm timer build:deps 1630936578551
npm verb unfinished npm timer build:run:install 1630936578553
npm verb unfinished npm timer build:run:install:node_modules/ffi 1630936578554
npm verb unfinished npm timer build:run:install:node_modules/ref 1630936578565
npm verb code 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\seokju.me\AppData\Local\npm-cache\_logs\2021-09-06T13_56_43_497Z-debug.log

seokju-na avatar Sep 06 '21 13:09 seokju-na

@cclauss I have the exact same problem and a very similar log to what @seokju-na posted. I think this might have something to do with using non-English version of Windows, as I see he also is using (mine is Polish).

maciej-trebacz avatar Oct 11 '21 18:10 maciej-trebacz

@seokju-na @maciej-trebacz is this still an issue for you? I see the ffi module is not supported in recent versions of Node: https://github.com/node-ffi/node-ffi/issues/511 . It was supported up to Node version 9.

The issue you have does not seem related to that though. But I can't reproduce it. Is it happening with some new and supported package?

It may be related to the configuration of your system. Do you have any permissions set that can cause this?

huseyinacacak-janea avatar Feb 28 '24 12:02 huseyinacacak-janea

The full log above contains the line:

node-gyp -v v7.1.2

Can this behavior be reproduced on a current version of node-gyp?

  • https://github.com/nodejs/node-gyp/releases

cclauss avatar Feb 28 '24 13:02 cclauss

This issue seems no longer relevant as it uses a no longer supported version of Node. If there are no objections, I will close this issue next Mon-Tue. In case something similar happens again please open a new issue.

StefanStojanovic avatar Apr 17 '24 11:04 StefanStojanovic