2.在使用"node-xlsx" 模块时报" TypeError: Object function Object() { [native code] } has no method 'assign' "


最近做一个关于数据库数据以xls格式导出的功能。由于之前用的"excel-export"模块功能有不是很全。也有可能是我没完全弄明白怎么使用这个模块生成多页的excel文件吧。后来就选用了'node-xlsx'模块来做。但是在使用demo的时候,会报一个TypeError: Object function Object() { [native code] } has no method 'assign的错误。网上查了半天也没找到相关信息。后来终于找到一篇文章。(链接:https://www.cnblogs.com/theswiftworld/p/node-object-assign.html)。里面的一语句话告诉了我原因:"老版本的 ECMAScript 6 以下引擎是不支持 Object.assign 函数的."然后我恍然大悟,原来是我的node版本太低了。找到原因,现在来解决吧。

1.首先把'object-assign'模块下载下来。(具体的下载方法,我就不多说了,相信写node的人都知道)

2.把这个模块里面的方法替换掉'node-xlsx'模块中使用的assign()方法即可。

好了,这样就完美解决问题了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 Vue使用crypto-js时报错TypeError: Object(...) is not a function 【python问题系列--3】TypeError: 'builtin_function_or_method' object has no attribute '__getitem__' Vue 使用自定义组件时报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' TypeError: 'method' object is not iterable python 报错 TypeError: 'builtin_function_or_method' object is not subscriptable [Trouble Shooting - Python] TypeError: 'builtin_function_or_method' object is not subscriptable 报错TypeError: Object(...)(...).then(...) is not a function" [Android] Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx' TypeError: Object(…) is not a function vue中使用scss时报错(Module build failed: TypeError: this.getResolve is not a function at Object.)
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM