Argon2 很难在 MacOS 上使用 Angular 8:实际上根本不起作用 [英] Argon2 is difficult to get working with Angular 8 on MacOS: actually not working at all

查看:32
本文介绍了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() 并在我的代码中使用它(通过进行验证调用),我将在尝试执行 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 升级
  3. npm install argon2 --save-dev

希望有帮助.

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

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