You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ npm i
$ node example.js
Hello wonderful person! :) Thanks for using GUN, please ask forhelp on http://chat.gun.eco if anything takes you longer than 5min to figure out!
REDACTED/node_modules/gun/lib/time.js:3
var ify = Gun.node.ify, u;
^
TypeError: Cannot read properties of undefined (reading 'ify')
at REDACTED/node_modules/gun/lib/time.js:3:21
at Object.<anonymous> (REDACTED/node_modules/gun/lib/time.js:138:2)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at cjsLoader (node:internal/modules/esm/translators:345:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:294:7)
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
Node.js v20.10.0
This error occurs both when importing using the require and import syntax. Additionally, the error persists when attempting to import 'gun' instead of 'gun/gun.js'. However, it does not occur when running the code in the browser using a script tag to import gun as shown below:
Thank you for reporting this issue. It seems like the 'gun/lib/time.js' module is trying to access a property of Gun.node before it's defined, hence the TypeError: Cannot read properties of undefined (reading 'ify').
One possible solution could be to ensure that Gun.node is properly initialized before importing 'gun/lib/time.js'. However, without knowing the internals of the 'gun' library, it's hard to provide a definitive solution.
As a workaround, you might want to consider importing the entire 'gun' library instead of specific modules. This should ensure that all dependencies are correctly initialized:
When I attempt to import
'gun/lib/time.js'
within Node.js, I encounter the following error. Here is a minimal reproducible example:This error occurs both when importing using the
require
andimport
syntax. Additionally, the error persists when attempting to import'gun'
instead of'gun/gun.js'
. However, it does not occur when running the code in the browser using a script tag to import gun as shown below:The text was updated successfully, but these errors were encountered: