jjzjj

TypeError

全部标签

ruby-on-rails - ERROR : While executing gem . .. (TypeError) 不兼容的编码文件格式(无法读取)

我在使用Ruby2.4.4版和macOSMojave运行bundleinstall时遇到了这个问题:Fetchingnokogiri1.8.5Installingnokogiri1.8.5withnativeextensionsGem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension.ERROR:cannotdiscoverwherelibxml2islocatedonyoursystem.pleasemakesure`pkg-config`isinstalled.所以我跑了xcode-select--install但是当我运

Ruby 'is_a?' 需要类或模块 (TypeError)

我正在尝试使用Ruby并尝试创建一个小型银行账户程序。当我运行这行与create_account一起运行的特定代码时:unless@response.is_a?Integer&&@response.to_str.length==4puts"Yourresponsemustbe4numbersinlength."create_accountelse@pin=@responseputs"Yourpinhasbeenset."end我收到这样的回复:bank_account.rb:24:in'is_a?':classormodulerequired(TypeError)frombank_ac

Ruby 没有将 Fixnum 隐式转换为 String (TypeError)

我正在尝试回答ChrisPine的“学习编程”一书中的以下问题:Leapyears.Writeaprogramthatasksforastartingyearandanendingyearandthenputsalltheleapyearsbetweenthem(andincludingthem,iftheyarealsoleapyears).Leapyearsareyearsdivisibleby4(like1984and2004).However,yearsdivisibleby100arenotleapyears(suchas1800and1900)unlesstheyareal

ruby-on-rails - Rails 3.1 中的 Rails.cache 错误 - TypeError : can't dump hash with default proc

我在3.1.0.rc4(ruby1.9.2p180(2011-02-18修订版30909)[x86_64-darwin10])上遇到Rails.cache方法问题。该代码在2.3.12(ruby1.8.7(2011-02-18补丁级别334)[i686-linux],MBARI0x8770,RubyEnterpriseEdition2011.03)上的同一应用程序中运行良好,但在升级后开始返回错误。我还没弄明白为什么。当尝试缓存具有多个作用域的对象时似乎会发生错误。此外,无论有多少范围,使用lambda的任何范围都会失败。我曾因这些模式而失败:Rails.cache.fetch("ke

Ruby - 无法修改卡住的字符串(TypeError)

得到...'[]=':can'tmodifyfrozenstring(TypeError)尝试修改我认为是ARGV[0]的副本时。每个结果相同arg=ARGV[0]arg_cloned=ARGV[0].clonearg_to_s=ARGV[0].to_sarg['x']='y'arg_cloned['x']='y'arg_to_s['x']='y' 最佳答案 因为谷歌花了太长时间才找到正确的答案......需要做的arg_dup=ARGV[0].dup 关于Ruby-无法修改卡住的字符串

JavaScript 错误 : Uncaught TypeError: Cannot read property 'left' of undefined

这是一个非常烦人的错误,关于这个控制台错误似乎有各种各样的问题。使用chrome在控制台中使用它并没有给我很多东西。/***Dropdownmenupositioning*/loc.dropMenuPositioning=function(){vardropMenu=$('.js-dropdown-item-wrap');varmainNavigationOffset=$('.js-nav-container>ul').offset();varmainNavigationPosition=mainNavigationOffset.left;dropMenu.css({'left':ma

javascript - 未捕获的 TypeError : (0 , _store.configureStore) 不是函数

这个问题在这里已经有了答案:WhenshouldIusecurlybracesforES6import?(11个答案)关闭6年前。商店.jsimport{createStore,applyMiddleware}from'redux';importcreateLoggerfrom'redux-logger';importrootReducerfrom'./reducers/index';constlogger=createLogger();constcreateStoreWithMiddleware=applyMiddleware(logger)(createStore);exportd

javascript - Ember JS 教程 : TypeError: Cannot read property 'maps' of undefined

我目前正在浏览他们网站上的官方EmberJS教程,我在thispart上.当我运行emberserve时,应用程序本身一切正常,但问题是当我为新服务运行单元测试时。我正在运行embertest--server时出现错误,我截图如下:单元测试代码:import{moduleFor,test}from'ember-qunit';importEmberfrom'ember';constDUMMY_ELEMENT={};letMapUtilStub=Ember.Object.extend({createMap(element,location){this.assert.ok(element,'

javascript - undefined variable 怎么会抛出类型错误?

我有一个用户遇到错误TypeError:aisundefined我很困惑这是怎么发生的。尝试访问undefinedvariable不会引发引用错误吗?在什么情况下会抛出类型错误? 最佳答案 正如@jgillich在他的回答中所指出的,以下代码在undefined对象上产生了一个TypeError。>aReferenceError:aisnotdefined>vara;>a.xTypeError:aisundefined要了解原因,我们可以引用ECMAScript5.1规范部分11.2.1PropertyAccessors.我们对第5

javascript - react 教程 : Uncaught TypeError: Cannot read property 'data' of null

我正在关注React教程:http://facebook.github.io/react/docs/tutorial.html我只是之后http://facebook.github.io/react/docs/tutorial.html#fetching-from-the-server我在SO上经历了类似的问题,但没有找到适合我的具体案例的解决方案。vardata=[{author:"PeteHunt",text:"Thisisonecomment"},{author:"JordanWalke",text:"Thisis*another*comment"},{author:"BobLi