草庐IT

index_not_found_exception

全部标签

javascript - Uncaught ReferenceError : process is not defined

我正在使用node.js创建一个网络应用程序。当我运行应用程序时(通过在浏览器上打开index.html或在终端上使用命令“npmstart”)我收到两个错误:UncaughtReferenceError:processisnotdefined未捕获的ReferenceError:未定义要求我解决了“requireisnotdefined”错误,具体方法是在我的index.htmlhead标签中包含指向this的链接。脚本,其中定义了require函数。但是,我找不到类似的过程函数。我的问题是双重的:为什么内置的node.js模块需要重新定义?为什么它们不被识别为“内置模块”?术语“内

javascript - Array.find(value) 返回值 'is not a function'

我正在尝试在AngularJS数组上使用JavaScript的find()函数。这是合法的,对吧...?这个非常简单的代码给我带来了一些问题。这是说$scope.names.find(name1)的返回值不是函数。TypeError:Name1不是函数if($scope.names.find(name1)!==name1){$scope.names.push(name1);}我也试过...if($scope.names.find(name1)===undefined){$scope.names.push(name1);}和if(!$scope.names.find(name1)){$s

javascript - 未捕获的类型错误 : Failed to execute 'observe' on 'MutationObserver' : parameter 1 is not of type 'Node'

所以我下面的代码在jsfiddle中独立运行。但出于某种奇怪的原因..在将它推送到实时服务器后,我一直收到此错误:/我无法弄清楚为什么......错误:mycodewitherror.js:23UncaughtTypeError:Failedtoexecute'observe'on'MutationObserver':parameter1isnotoftype'Node'.js:$(document).ready(function(){//Thebelowcollectsuserloginname,newlogindateandtime,andprevioususeURLvarelem

javascript - 拒绝访问 : Not authorized to perform sts:AssumeRoleWithWebIdentity

我已经查看过类似的问题,但无法解决我的问题。我正在开发一个Web应用程序,用户将在其中使用AWSCognito的身份验证进行身份验证。注册部分没问题,但是当我尝试登录时,出现“未授权”异常。我已经尝试将自定义策略附加到我的IAMAngular色(授权sts:AssumeRoleWithWebIdentity),但没有成功。代码现在是这样写的:varcognitoUser=newAWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);cognitoUser.authenticateUser(authenticatio

javascript - 使用 webpack-dev-server 时,html-webpack-plugin 不会将 js 文件注入(inject) index.html

这是我的webpack配置:varpath=require('path');varwebpack=require('webpack')varHtmlWebpackPlugin=require('html-webpack-plugin')varfs=require('fs'),buildPath='./dist/';varfolder_exists=fs.existsSync(buildPath);if(folder_exists==true){require('shelljs/global')rm('-rf','dist')};module.exports={entry:'./src/

javascript - react : componentDidMount + setState not re-rendering the component

我对使用componentDidMount和setState来使用react并努力更新自定义组件相当陌生,这似乎是推荐的做法。下面是一个示例(包括用于获取数据的axiosAPI调用):importReactfrom'react';import{MyComponent}from'my_component';importaxiosfrom'axios';exportdefaultclassExampleextendsReact.Component{constructor(props){super(props);this.state={data:[]};}GetData(){returnax

javascript - 将 async/await 与 babel 一起使用时 regeneratorRuntime is not defined 错误

我正在使用异步/等待代码,并且收到“regeneratorRuntime未定义错误”。我已经尝试了堆栈溢出的几种解决方案,但我无法使它们中的任何一种起作用。这是我的配置:webpack.config.js:module.exports={entry:['babel-polyfill','./client/libs/compileTemplate/entry.jsx','./client/libs/compileTemplate/loginEntry.jsx'],output:{path:'/dist',publicPath:'/assets',filename:'[name].js'}

javascript - 处理 z-index 图层上的点击事件

我正在构建的map应用程序中有2个z-index图层。单击图层放大时出现问题。单击处理程序位于底层z-index图层上,我不希望它在单击覆盖图层中的控件时触发。我遇到的问题是,无论如何都会引发事件,但是当单击顶层上的某些内容时,事件的originalTarget属性不是底层中的图像。无论如何要改变这个? 最佳答案 这叫做事件冒泡,你可以通过event.stopPropagation()方法(IE中的event.cancelBubble())来控制它。您还可以通过从元素上的onwhatever属性调用的处理程序返回true/false

javascript - Sublime 的 JS 格式 : configure to not auto-format JSON

我一直在网上寻找一个好的Sublime(3)包来自动格式化我的各种语言的源代码,即JavaScript。我看到了这篇SOF帖子(SublimeText2:Autofixindentationforjavascript?),因此决定给出JSFormat一试。到目前为止,它似乎工作得很好......除了它在JS代码中处理JSON对象时。例如,假设我有这样一个函数:functionfoo(){return{name:'Dave',score:1000};}它返回一个JSON格式的JavaScript对象,更像是一个哈希对象。我喜欢在一行中编写这样的对象,因为它简单易读,尤其是因为它只是一个小

javascript - Angular : "tab" keycode event not firing

我有一个带有处理程序的表单字段,我想在用户使用return/enter或制表符故意接受值后触发到下一个字段。在这种情况下我不能使用onBlur,因为如果用户或系统模糊该字段,它当然会触发。我只希望它出现在键盘上。所以我有这个。我先输入了enter,效果很好。但是keycode==9不会触发处理程序。焦点只是移动到下一个字段。ng-keyup="($event.keyCode==13||$event.keyCode==9)&&packages.submitNumber('add',packages.addTrackingNumber)"有没有办法在enter或tab上触发?