我尝试使用npm install argon2 --save
在节点js上安装氩气2。
我认为python(不确定原因)或node-gyp有问题。
PS C:\angular\backend> npm install argon2 --save
> argon2@0.21.0 install C:\angular\backend\node_modules\argon2
> node-gyp rebuild
C:\angular\backend\node_modules\argon2>if not defined npm_config_node_gyp (node "C:\Users\matan\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\matan\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\matan\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:276:12)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\matan\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\angular\backend\node_modules\argon2
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\angular\backend\package.json'
npm WARN backend No description
npm WARN backend No repository field.
npm WARN backend No README data
npm WARN backend No license 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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\matan\AppData\Roaming\npm-cache\_logs\2019-04-30T13_02_07_305Z-debug.log
PS C:\angular\backend>
预期安装的argon2稍后将用于散列。
答案 0 :(得分:0)
从您的anaconda路径看来,您好像正在使用Python3。
gyp ERR! stack Error: Command failed: C:\Users\matan\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
这将解释print语句中的语法错误,因为它不是打印功能。尝试安装python2,或者如果已经安装了python2,请确保它在python3之前的路径中。
答案 1 :(得分:0)
处理此错误非常简单 如果您按照我的步骤进行操作,则可以解决NodeJS中gyp中的所有错误 在Windows操作系统中。
STEP1:转到此链接
找到并下载并安装Visual Studio 2019的构建工具 下载并安装它,然后检查nodejs tick,然后重新启动计算机。
STEP2:安装python 2.7并确保路径中存在itis,并且您可以使用python(不是python2)访问
第3步:安装软件包nom https://www.npmjs.com/package/windows-build-tools 确保使用Powershell
然后可以安装argon2或所需的任何软件包 :)