- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我尝试使用 ng update
从 5 迁移到 6,但出现错误
Uncaught ReferenceError: Buffer is not defined
at Object../node_modules/amazon-cognito-identity-js/node_modules/crypto-browserify/helpers.js (helpers.js:2)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/amazon-cognito-identity-js/node_modules/crypto-browserify/md5.js (md5.js:10)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/amazon-cognito-identity-js/node_modules/crypto-browserify/create-hash.js (create-hash.js:3)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/amazon-cognito-identity-js/node_modules/crypto-browserify/index.js (index.js:12)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/amazon-cognito-identity-js/es/AuthenticationHelper.js (vendor.js:47207)
at __webpack_require__ (bootstrap:81)
本地环境非常适合创建新的 Angular 项目。我不使用缓冲区。这是幕后的事情
有什么想法吗?
UPD
我正在尝试更新@types/node npm install --save-dev @types/node
+ @types/node@8.9.5
updated 1 package in 12.031s
[!] 26 vulnerabilities found [36141 packages audited]
Severity: 11 Low | 13 Moderate | 2 High
Run `npm audit` for more detail
如果我运行 npm audit
npm ERR! code ENOAUDIT
npm ERR! audit Your configured registry (https://registry.npmjs.org/) does not support audit requests.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/myname/.npm/_logs/2018-05-16T13_45_17_410Z-debug.log
最佳答案
好的,一个小时后,我终于设法让 Cognito 在我的 Angular 应用程序上运行(刚刚升级到 6.0)。
关于消息 global is not defined
(或者一些不记得的关闭)。将以下内容添加到 index.html 中:
<!doctype html>
<html lang="en">
<head>
...
<script>
var global = global || window;
</script>
</head>
然后,您可能会收到一条错误消息,指出 Buffer 未定义。
使用 npm 或 yarn 安装 buffer
包。并将以下内容添加到 polyfills.ts () 中:
global.Buffer = global.Buffer || require('buffer').Buffer;
Stackoverflow answers/github issues 对我有帮助,以防它在那之后没有为你修复:
Upgrading to angular-6.x gives "Uncaught ReferenceError: global is not defined"
https://github.com/aws/aws-amplify/issues/840#issuecomment-389459988
https://github.com/aws/aws-amplify/issues/678
关于Angular 6 未捕获的 ReferenceError : Buffer is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50371593/
描述:。在我的Vue 3和nuxt 3项目中,我使用VITEST进行测试。但我在运行测试时遇到了一个问题:。版本。以下是我的页面代码:。下面是我的测试myest.spec.ts:。以下是我的vites
你好吗?我正在研究带有 Ionic 3 教程的 Google map 。我已经完成了那里解释的一切,但是当项目启动时,出现了这个错误。我调查了很多,但没有任何效果。谢谢! Error: Uncaugh
我刚刚开始使用 Node.js 并尝试使用模块。我已经安装了 Node 和 npm,并确保一切顺利。我将在下面添加代码来向您展示我得到了什么。 我有两个 js 文件,它们在这里。 app.js: va
我是 Angularjs 的初学者,在理解模块和作用域方面有些困难。 我不断收到范围未定义的错误,但我不明白为什么。首先,我将 Controller 链接到我设置路由的位置,但是由于在单击提交按钮时调
我正在制作一个 HTML 模板引擎。 程序遍历 HTML,并找到 {{ }} 的所有实例。然后它会遍历计数器中的所有键,并用对 Controller 的引用替换变量名称的实例。 例如,如果我的 Con
在我的 React Native 应用程序中,我有一个 ProductScreen,其中导入两个文件来完成屏幕。 文件 1 (Products.js) 是我的产品列表 文件 2 (Data.js) 是
我有以下类(class): class ScheduledContent { constructor(knex) { this.knex = knex } ge
在以下代码中,obj.sayhello() 行意味着sayhello在 obj 的上下文/范围内执行。 str未在 var 中定义(通过 sayhello )方法。 JS 将在范围内查找变量,即在
我正在尝试使用字符串作为函数的一部分。 const import1 = require('./import1'); const import2 = require('./import2'); //on
var g = { lang: "ttt", l: function(){ console.log(lang); } } console.log(g.l());
$(document).ready(function(){ $('#name').val('Name1'); }); function clickMe(){ console.lo
我刚刚完成了 Meteor 包的开发。现在我想通过将它添加到新的 Meteor 应用程序来测试它: my_cool_package_name/package.js Package.on_use(fun
我在给定的 SSCCE 代码中收到以下错误: Error: ReferenceError: electron is not defined Source File: http://localhost/
我正在关注一个简单的 tut,它有望构建一个响应式 slider ,但是它一直告诉我控制台中有一个错误指向一个名为 advance() 的函数 这是 slider 的简单 html:
我正在尝试使用基于按钮点击的表格中的数据填充表格。我正在将数据传递到 javascript 函数中。 )" id="modifyEdu" class="btn btn-primary"
我需要能够检查一个变量是否存在(如果它没有分配给 {})而不在 javascript 中抛出错误。当我尝试这段代码时 if (a) {} 它抛出 Uncaught ReferenceError
我在设置中有一个 mochajs 测试文件和一个 javascript 代码文件,如下所示: /js/module/codefile.js /js/test/testfile.js codefile.
我正在尝试构建一个简单的 Bookmarklet,它将一些外部 Javascript 加载到页面中,目标是将像 Stackoverflow 那样的 Markdown 编辑器添加到另一个站点。我可以使用
我有一个基于 Django 的网络应用程序。我用 Scrapy Crawler抓取网页。目前,我的目标是能够使用 jQuery 和 AJAX 请求从网页内控制爬虫。 我的理论设置如下: 在网页上,我有
以下 JavaScript... if (eval('typeof admin_post_css_theme_dark-moon)=='function')) {/**/} ...触发以下错误消息..
我是一名优秀的程序员,十分优秀!