【发布时间】:2021-12-30 17:49:44
【问题描述】:
我正在使用 quasar cli 创建一个 vue 3 应用程序。我已经通过纱线安装了 jsonwebtoken。当我尝试编译应用程序时,出现以下错误:
App • ERROR • UI in ./node_modules/jwa/index.js
Module not found: Can't resolve imported dependency "crypto"
Did you forget to install it? You can run: yarn add crypto
App • ERROR • UI in ./node_modules/jwa/index.js
Module not found: Can't resolve imported dependency "util"
Did you forget to install it? You can run: yarn add util
App • ERROR • UI in ./node_modules/jws/lib/data-stream.js
Module not found: Can't resolve imported dependency "stream"
Did you forget to install it? You can run: yarn add stream
App • ERROR • UI in ./node_modules/jws/lib/data-stream.js
Module not found: Can't resolve imported dependency "util"
Did you forget to install it? You can run: yarn add util
我可以运行“yarn add util”和“yarn add stream”,这些错误就会消失,但我不知道这是否是问题的正确解决方案。无论如何,我不能只运行“yarn add crypto”来解决该错误。当你这样做时,你会收到以下警告......
warning crypto@1.0.1: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
但我不确定这里需要做什么才能“切换到内置的”,并且很好奇是否每个人在使用 jsonwebtoken 时都会遇到这种情况?
【问题讨论】: