Error "MSBuild.exe failed with exit code 1" in npm install ffi

Asked 2 years ago, Updated 2 years ago, 112 views

problems you are having
I'd like to use FFI in Node.js, but when npm install ffi,

gypErr:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe failed with exit code:1

The error appears with .
Windows built tools are already installed.

environment

  • Node 14.15.0

Supplementary

  • The current version is tested to run on node v0.6, v0.8, v0.9 and v0.10. was pointed out in the comment that the Node version itself may not be compatible, so I dropped it to v0.10.
 gyp ERR! stack Error: `gyp`failed with exit code:1

and errors.

node.js npm

2022-09-30 17:39

1 Answers

Support for ffi seems to have ended with Node 11.
ffi-napi seems to be the replacement for Node 12 and later.https://www.npmjs.com/package/ffi-napi
There was no error using this.
ffi-napi is the same as ffi.

Installation method
For Windows,
Install windows build tools on Powershell with administrator privileges.
Then install node-gyp under npm-g install node-gyp.
Then enter npm install ffi-napi.

How-to
var ffi=require('ffi-napi');
It is the same as ffi except for writing .
If you use ref, ref-napi is supported instead, so install it separately.

Reference site: https://usagi.hatenablog.jp/entry/2020/03/18/191928


2022-09-30 17:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.