Argon2在MacOS上很难与Angular 8配合使用:实际上根本无法配合使用 [英] Argon2 is difficult to get working with Angular 8 on MacOS: actually not working at all

查看:130
本文介绍了Argon2在MacOS上很难与Angular 8配合使用:实际上根本无法配合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与之合作:

  • MacOS Mojave
  • 角度8
  • 节点v12.12.0
  • npm v6.13.4

并尝试使Argon2在我的Angular 8应用中正常工作.

and trying to make Argon2 to work in my Angular 8 app.

要使用Argon2,需要全局安装gcc和node-gyp. 我确实按照Argon2的npm页面上的指示安装了它们.已安装GCC v9.但是,我反复遇到执行问题:

In order to use Argon2 it is required to install gcc and node-gyp globally. I did install them as indicated on the npm pages of Argon2. GCC v9 was installed. But, I had repeatedly problems executing:

CXX=g++-9 npm install

我不断收到有关stdlib ++的错误.我尝试使用Apple的CLang ++,并成功构建了:

I kept getting errors about stdlib++ . I tried using Apple's CLang++ and got a successful build with:

CXX=clang++ npm install

我在Angular项目中导入了argon2以便进行密码哈希和验证.哈希似乎运行良好(没有错误),但是一旦我导入argon2.verify()并在我的代码中使用它(通过执行verify-call),尝试执行npm run start时就会出错.只是尝试使用相应的私钥和证书启动受保护的httpserver(ssl/tls).

I imported argon2 in my angular project in order to do password hashing and verification. Hashing seems to be working well (no errors) but as soon as I import argon2.verify() and use it in my code (by making a verify-call) I will get an error when trying to execute npm run start. Just trying to start the httpserver secured (ssl/tls) with corresponding private key and certificate.

我得到的错误是一些神秘的错误:

ERROR in ./node_modules/node-gyp-build/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/[username-deleted]/WebstormProjects/my-app/node_modules/node-gyp-build'

我已经看到有关互联网上可能类似问题的评论和投诉,并且人们指的是Webpack配置文件中的一些调整,但是目前我的项目中没有此配置文件.我尝试了其他版本的node-gyp-build,但未解决. 显然argon2.hash()(其用法)可以正常运行,而不会引起问题,但是,一旦我在代码中引入argon2.verify()并使用npm run start运行我的应用程序,我就会得到上述错误.

I have seen comments and complaints on probably similar problems on internet and people referring to some adjustment in a Webpack config file but at this point I dont have this config file in my project. I tried other versions of node-gyp-build but not resolved. Apparently argon2.hash() (its usage) is working without causing problems, but as soon as I introduce argon2.verify() in my code and run my app with npm run start I get the above error.

任何有类似问题的人以及如何解决此问题?

Any one with similar problem and how this problem was resolved?

推荐答案

我遇到了相同的问题,并通过安装Xcode命令行工具解决了该问题:

I had the same issue and fixed it by installing the Xcode Command Line Tools:

  1. xcode-select --install
  2. npm upgrade
  3. npm install argon2 --save-dev
  1. xcode-select --install
  2. npm upgrade
  3. npm install argon2 --save-dev

希望有帮助.

这篇关于Argon2在MacOS上很难与Angular 8配合使用:实际上根本无法配合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆