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