在Windows中安装node-argon2

时间:2019-03-16 13:58:31

标签: node-gyp argon2-ffi

背景很少
我试图安装node-argon2,但安装时遇到问题。我一直在尝试下载GCC,我已经按照docs中的说明安装了node-gyp

但是我在此步骤上一直失败。.

CXX=g++-6 npm install argon2

我不知道该函数的功能,而当我尝试在终端中启动该功能时,结果便会显示出来。

> argon2@0.21.0 install C:\Users\BizCon\Projects\express-ticket\node_modules\argon2
> node-gyp rebuild


C:\Users\BizCon\Projects\express-ticket\node_modules\argon2>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\BizCon\Projects\express-ticket\node_modules\argon2\build\libargon2.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\BizCon\Projects\express-ticket\node_modules\argon2
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN babel-loader@8.0.5 requires a peer of @babel/core@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN babel-loader@8.0.5 requires a peer of webpack@>=2 but none is installed. You must install peer dependencies yourself.
npm WARN express-server@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! argon2@0.21.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the argon2@0.21.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

2 个答案:

答案 0 :(得分:0)

安装之前

在继续安装之前,您必须具有node-gyp全局安装,以及GCC> = 5 / Clang> = 3.3。 在Windows上,您必须在Visual Studio 2015或更高版本下进行编译

node-argon2仅工作,并且已针对Node> = 8.0.0进行了测试。

答案 1 :(得分:0)

我问这个的时候我很粗心。希望无论您是谁,参加这个论坛的人都认真完成node-gyp存储库上的步骤。

您看到的是Installation Guide of node-gyp for Windows

有两个选项。 只需使用第一个!

  

使用Microsoft的工具安装所有必需的工具和配置   在提升的PowerShell或CMD.exe中使用npm install --global --production windows-build-tools的Windows-build-tools(以   管理员)。

是的,这个npm install --global --production windows-build-tools

当时我真是个菜鸟,我读为“ npm install -global--production windows-build-tools ”。哇!我现在可以使用node-argon2。哈哈哈哈哈哈哈哈。