我正在與gundb電子應用程序。在所有其他工作後,我做了一個npm install --save gun
。它完成了這個警告:Webpack,槍,無法解決文件等,槍要求無法解決模塊'FS'
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
當我嘗試:
require('gun');
var endpoints;
var gun = Gun(endpoints);
我得到一個非常長的錯誤,因爲我不能做的名單。他們先從:
.../node_modules/fs doesn't exist
.../node_modules/fs.webpack.js doesn't exist
.../node_modules/fs.web.js doesn't exist
.../node_modules/fs.js doesn't exist
.../node_modules/fs.json doesn't exist
及以下不能解析:
@ ./~/gun/lib/file.js 14:10-23
@ ./~/gun/lib/wsp.js 61:39-52
@ ./~/ws/lib/WebSocketServer.js 15:10-2
@ ./~/options/lib/options.js 6:9-2
@ ./~/aws-sdk/lib/api_loader.js 1:9-22
@ ./~/aws-sdk/lib/services.js 1:9-22
我在Linux上。是否fsevent槍npm的依賴?
UPDATE
要刪除許多其它變量可能,我減少了我的package.json文件下降到僅電子....消除了可能的WebPack問題和其他依賴。我也刪除了我的node_modules並做了一個新的npm install & npm install gun
。
這透露了更多有用的錯誤:
Uncaught ReferenceError: Gun is not defined gun.js:1470
其中指出:
if(typeof window !== "undefined"){ Gun.request = request }
if(typeof module !== "undefined" && module.exports){ module.exports.request = request }
這fsevent警告很正常。他們沒有關係。 –
這個問題也可能對其他Webpack/GUN錯誤有幫助(對於那些從Google點擊這個問題的人,但這不是正確的問題):http://stackoverflow.com/questions/39001582/running-gunjs-with -reactjs-and-webpack-throws-reference-error-in-console/39003291#39003291 – marknadal