2017-06-25 49 views
0

我正在嘗試使用角2流星,並且在服務器端使用節點庫(如FS)時出現了一些問題。MeteorJS不能在服務器端使用打字機使用節點庫?

import fs from 'fs'; 結果:

(3, 16): Cannot find module 'fs'. 
20170625-07:41:23.740(3)? (STDERR) TypeError: Cannot read property 'readFile' of undefined 
W20170625-07:41:23.740(3)? (STDERR)  at meteorInstall.server.wordGraph.wordGraph.js (server/wordGraph/wordGraph.ts:8:3) 
W20170625-07:41:23.740(3)? (STDERR)  at fileEvaluate (packages\modules-runtime.js:333:9) 
W20170625-07:41:23.741(3)? (STDERR)  at require (packages\modules-runtime.js:228:16) 
W20170625-07:41:23.741(3)? (STDERR)  at server/main.ts:5:4 

回答

0

使用Npm.require,而不是像

var fs = Npm.require('fs'); 
相關問題