草庐IT

find_module

全部标签

javascript - '类型错误 : undefined is not a function' when jumping 'tween modules

我在Node中不断遇到这个问题,每当我相互调用函数时,我的应用程序就会崩溃。我已经做了这个最小的工作示例(按照它的方式工作给了我错误):启动模块varmodule2=require('./module2');vardata='data';module2.doStuff(data);模块2varmodule3=require('./module3');functiondoStuff(data){//Stuffhappensto'data'module3.takeStuff(data);}functiondoSomethingElse(data){console.log(data);}mo

javascript - 导入节点模块时出现流错误 "cant resolve module"

我最近将此添加到我的流程配置中,因为大量与流程拾取的节点模块相关的错误[ignore].*/node_modules/.*这解决了那些错误,但引入了新错误。现在,我导入的每个模块都会导致错误,其中流程表示它无法解决它,因此让我认为这是由于我添加的忽略规则造成的。有没有办法解决这个问题,因为这里删除这一行只会引入不同类型的错误,保留它仍然会出错。 最佳答案 现在有点晚了,但对于以后遇到这个问题的任何人来说:你不应该忽略你的node_modules文件夹。Flow应该从该文件夹中读取并分析其中的文件。

javascript - 有人可以解释这个 Array.prototype.find() polyfill 吗?

在此MDN页面上[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find]有这个polyfill:if(!Array.prototype.find){Object.defineProperty(Array.prototype,'find',{enumerable:false,configurable:true,writable:true,value:function(predicate){if(this==null){thrownewTypeError('Ar

javascript - 类型错误 : module is not a function AngularJS & Jasmine

在我的示例应用程序中,我像这样测试运行器收藏夹Controller:varmodule=angular.module('AngularSampleApp',[]);varFavoritesController=module.controller('FavoritesController',functionfavoritesController($scope){$scope.phones=[{'name':'NexusS','snippet':'FastjustgotfasterwithNexusS.'},{'name':'MotorolaXOOM™withWi-Fi','snippet

javascript - 网页包 2 : cannot resolve module

我有这样一个项目:root/webpack-config.jsapp/app.jsjs/dep.jscore/module.js这是webpack配置文件:module.exports={entry:'./app/app.js',output:{path:__dirname,filename:"[name]-bundle.js"},module:{loaders:[{test:/\.js$/,loader:'babel-loader',exclude:/node_modules/}]},resolve:{modulesDirectories:['core']}...在app.js中,我

javascript - 弃用警告 : Collection#find: pass a function instead

我是node.js的新手,我目前正在使用discord.js制作Discord机器人。一旦使用了任何bot命令,控制台就会打印出DeprecationWarning。例如:(node:15656)DeprecationWarning:Collection#find:passafunctioninstead(node:15656)有时是另一个数字,几乎总是在变化。这就是我的代码的样子(只有一个命令,我有多个命令,但所有命令都出现此错误):constbotconfig=require("./botconfig.json")constDiscord=require("discord.js")

javascript - 使用 Webpack 时 Typescript 编译器 "cannot find module"需要 CSS/图像 Assets

我正在编写vanillaJavascript,但使用Typescript编译器的checkJs选项在VSCode中进行类型检查。我将Webpack设置为加载各种Assets类型(CSS、图像等),这对于构建工作正常,但代码将这些语句视为错误。例如,在这段代码中require("bootstrap");require("bootstrap/dist/css/bootstrap.css");varimg=require("../img/image.png");第一行很好,但接下来的两行都在require()的(字符串)参数下显示错误,工具提示为“找不到模块(名称)”。我已经安装了@type

javascript - JQuery 用 find() 反转 each()

我知道以前有人问过这种问题,但是一般的解决方法$($("input").get().reverse()).each(function(){/*...*/});对我不起作用。我有一个xml文档,其中包含我想在网页上显示的音乐会列表。所以,在JQuery中:$.ajax({type:"GET",url:"concerts.xml",dataType:"xml",cache:false,success:function(xml){$(xml).find('concert').each(function(){/*dostuff*/});}});但是,我想以相反的顺序显示音乐会。所以,我尝试了以

javascript - 错误 : Couldn't find preset "es2015" relative to directory

当我尝试使用babel时出现以下错误。Error:Couldn'tfindpreset"es2015"relativetodirectorywebpack.config.jsmodule.exports={entry:'./main.js',ourput:{path:'./',filename:'index.js'},devServer:{inline:true,port:3333},module:{loaders:[{test:/\.js$/,exclude:/node_modules/,loader:'babel',query:{presets:['es2015','react']

javascript - Meteor template.find 未定义

我正在尝试使用template.find让我的生活更轻松。但在javascript控制台中我得到:undefinedisnotafunction这是我的。它在template.find(...)上被绊倒了Template.superuserHUD.events={'clickinput.new_device':function(template){varid=template.find(".new_device_id").value;Device_IPs.insert({ID:id,IP:"NotConnected"});}}有什么想法吗? 最佳答案