鍍金池/ 問答/數(shù)據(jù)庫(kù)  網(wǎng)絡(luò)安全  HTML/ 在使用node8.10.0版本 export 報(bào)錯(cuò)

在使用node8.10.0版本 export 報(bào)錯(cuò)

clipboard.png

如圖報(bào)錯(cuò)信息是這樣的,以前使用node都不會(huì)有export問題,難道是我node版本太高了嘛。

回答
編輯回答
大濕胸

拼寫錯(cuò)了

exports.create = ...
2017年3月7日 19:25
編輯回答
做不到

是自己操作錯(cuò)誤了,應(yīng)該是exports

exports 與module.exports的區(qū)別主要為以下三點(diǎn)

1.
module.exports 初始值為一個(gè)空對(duì)象 {}
2.
exports 是指向的 module.exports 的引用
3.
require() 返回的是 module.exports 而不是 exports

意思就是exports和module.exports一開始都是一個(gè)指向空對(duì)象{}的指針

而在其他地方require得到的永遠(yuǎn)是module.exports的值,
如果修改了module.exports的指向,那么無論對(duì)exports怎么修改都無法影響require得到的值

2018年9月13日 06:09