Closed SepiaGroup closed 6 years ago
Hi @SepiaGroup -- hope you can eventually port the changes here later :smile:
Did you run npm i
when you cloned the plugin? There are some dependencies that need installing, though I think npm link
should do that for you.
If there's a stack trace, I'd like to see it as well, otherwise there's not much to go on :frowning:
Julian,
Yes I will port the changes if I can. However, I would also be willing to pay you to do this this work if have the time ☺ . I would be really nice if this was all configurable in NodeBB and that is something that i don't know if I will be able to do. Using the Cognito SDK is pretty straight forward https://github.com/aws/aws-amplify/tree/master/packages/amazon-cognito-identity-js and I can give a lot of help with it since I use it a lot.
So back to my issue with setting up with NodeBB: I do the following and receive an error. I apologize if I am doing something obviously wrong, but just cannot figure out what it is.
npm i -g npm@4 -- doing this per several comments about npm v5 link breaking nodebb
my setup is
npm v 4.6.1
node 8.9.4
os windows 10
mkdir c:\dev
cd \dev
git clone -b v1.8.0 https://github.com/NodeBB/NodeBB.git
git clone https://github.com/julianlam/nodebb-plugin-session-sharing.git
cd c:\dev\nodebb-plugin-session-sharing
npm i
npm link
cd c:\dev\nodebb
nodebb setup -- this does the npm install, setup the db using MongoDB - no errors
npm link nodebb-plugin-session-sharing -- from the output it is pointing to the correct directory.
nodebb dev
in a browser (chrome) navigate to localhost:4567 login with the Admin account - all works so far
go to Admin tab
Extend/Plugins/Installed - search for nodebb-plugin-session-sharing - click Activate
confirm
restart Nodebb
received the following:
NodeBB v1.8.0 Copyright (C) 2013-2014 NodeBB Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
For the full license, please visit: http://www.gnu.org/copyleft/gpl.html
Clustering enabled: Spinning up 1 process(es).
2018-03-20T01:25:50.105Z [13720] - info: Initializing NodeBB v1.8.0 http://localhost:4567
2018-03-20T01:25:50.109Z [13720] - verbose: * using mongo store at 127.0.0.1:27017
2018-03-20T01:25:50.109Z [13720] - verbose: * using themes stored in: c:\dev\NodeBB\node_modules
2018-03-20T01:25:50.268Z [13720] - warn: You have no mongo username/password setup!
2018-03-20T01:25:52.519Z [13720] - verbose: [minifier] utilizing a maximum of 2 additional threads
2018-03-20T01:25:52.552Z [13720] - verbose: Checking dependencies for outdated modules
2018-03-20T01:25:53.668Z [13720] - warn: You have no mongo username/password setup!
2018-03-20T01:25:53.751Z [13720] - verbose: [notifications.init] Registering jobs.
2018-03-20T01:25:53.762Z [13720] - verbose: [user/jobs] (Re-)starting user jobs...
2018-03-20T01:25:53.765Z [13720] - verbose: [user/jobs] Starting job (digest.daily)
2018-03-20T01:25:53.766Z [13720] - verbose: [user/jobs] Starting job (digest.weekly)
2018-03-20T01:25:53.768Z [13720] - verbose: [user/jobs] Starting job (digest.monthly)
2018-03-20T01:25:53.769Z [13720] - verbose: [user/jobs] Starting job (reset.clean)
2018-03-20T01:25:53.770Z [13720] - verbose: [user/jobs] 4 jobs started
2018-03-20T01:25:53.772Z [13720] - verbose: [emailer] Setting up SMTP fallback transport
2018-03-20T01:25:53.830Z [13720] - verbose: [emailer] Built custom email templates
2018-03-20T01:25:53.832Z [13720] - info: [themes] Using theme nodebb-theme-persona
2018-03-20T01:25:53.845Z [13720] - verbose: [plugins] Initializing plugins system
2018-03-20T01:25:53.870Z [13720] - verbose: [plugins] Loaded plugin: nodebb-plugin-composer-default
2018-03-20T01:25:53.879Z [13720] - verbose: [plugins] Loaded plugin: nodebb-theme-persona
2018-03-20T01:25:53.998Z [13720] - verbose: [plugins] Loaded plugin: nodebb-plugin-markdown
2018-03-20T01:25:54.030Z [13720] - verbose: [plugins] Loaded plugin: nodebb-plugin-mentions
2018-03-20T01:25:54.039Z [13720] - verbose: [plugins] Loaded plugin: nodebb-widget-essentials
2018-03-20T01:25:54.053Z [13720] - verbose: [plugins] Loaded plugin: nodebb-rewards-essentials
2018-03-20T01:25:54.055Z [13720] - verbose: [plugins] Found 3 sound file(s) for plugin nodebb-plugin-soundpack-default
2018-03-20T01:25:54.056Z [13720] - verbose: [plugins] Loaded plugin: nodebb-plugin-soundpack-default
2018-03-20T01:25:54.238Z [13720] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji
2018-03-20T01:25:54.272Z [13720] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-android
2018-03-20T01:25:54.277Z [13720] - info: [plugins] Plugins OK
2018-03-20T01:25:54.353Z [13720] - verbose: [emoji] Building emoji assets
2018-03-20T01:25:54.372Z [13720] - verbose: [emoji] Loaded packs android
2018-03-20T01:25:54.416Z [13720] - verbose: [hotswap] Router with id `plugins` replaced successfully
2018-03-20T01:25:54.418Z [13720] - verbose: [plugins] All plugins reloaded and rerouted
2018-03-20T01:25:54.421Z [13720] - verbose: [hotswap] Router with id `auth` replaced successfully
2018-03-20T01:25:54.429Z [13720] - info: Routes added
2018-03-20T01:25:54.433Z [13720] - verbose: [meta/blacklist] Loading 0 blacklist rule(s)
2018-03-20T01:25:54.434Z [13720] - info: NodeBB Ready
2018-03-20T01:25:54.439Z [13720] - info: Enabling 'trust proxy'
2018-03-20T01:25:54.450Z [13720] - info: NodeBB is now listening on: 0.0.0.0:4567
2018-03-20T01:28:43.764Z [13720] - warn: Missing translation "admin/menu:plugins/emoji"
2018-03-20T01:31:06.979Z [13720] - verbose: [build] building the following targets: plugin static dirs, requirejs modules, client js bundle, admin js bundle, client side styles, admin control panel styles, templates, languages, sounds
started
2018-03-20T01:31:06.982Z [13720] - warn: You have no mongo username/password setup!
2018-03-20T01:31:07.010Z [13720] - info: [themes] Using theme nodebb-theme-persona
2018-03-20T01:31:07.019Z [13720] - verbose: [plugins] loading the following fields from plugin data: staticDirs, modules, clientScripts, acpScripts, cssFiles, lessFiles, acpLessFiles, languageData, soundpack
2018-03-20T01:31:07.029Z [13720] - verbose: [plugins] Found 1 less file(s) for plugin nodebb-plugin-composer-default
2018-03-20T01:31:07.032Z [13720] - verbose: [plugins] Found 1 less file(s) for plugin nodebb-plugin-markdown
2018-03-20T01:31:07.037Z [13720] - verbose: [plugins] Found 1 css file(s) for plugin nodebb-widget-essentials
2018-03-20T01:31:07.039Z [13720] - verbose: [plugins] Found 1 less file(s) for plugin nodebb-plugin-emoji
2018-03-20T01:31:07.040Z [13720] - verbose: [plugins] Found 1 less file(s) for plugin nodebb-plugin-session-sharing
2018-03-20T01:31:07.045Z [13720] - verbose: [plugins] Found 10 AMD-style module(s) for plugin nodebb-plugin-composer-default
2018-03-20T01:31:07.048Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-plugin-composer-default
2018-03-20T01:31:07.049Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-theme-persona
2018-03-20T01:31:07.051Z [13720] - verbose: [plugins] found 2 static directories for nodebb-plugin-markdown
2018-03-20T01:31:07.054Z [13720] - verbose: [plugins] Found 1 AMD-style module(s) for plugin nodebb-plugin-markdown
2018-03-20T01:31:07.057Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-plugin-markdown
2018-03-20T01:31:07.058Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-plugin-markdown
2018-03-20T01:31:07.067Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-plugin-mentions
2018-03-20T01:31:07.070Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-plugin-mentions
2018-03-20T01:31:07.074Z [13720] - verbose: [plugins] found 1 static directories for nodebb-rewards-essentials
2018-03-20T01:31:07.076Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-rewards-essentials
2018-03-20T01:31:07.080Z [13720] - verbose: [plugins] Found 3 sound file(s) for plugin nodebb-plugin-soundpack-default
2018-03-20T01:31:07.081Z [13720] - verbose: [plugins] found 1 static directories for nodebb-plugin-emoji
2018-03-20T01:31:07.083Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-plugin-emoji
2018-03-20T01:31:07.084Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-plugin-session-sharing
2018-03-20T01:31:07.084Z [13720] - verbose: [plugins] Found 1 js file(s) for plugin nodebb-plugin-session-sharing
2018-03-20T01:31:07.092Z [13720] - verbose: [plugins] Found 2 js file(s) for plugin nodebb-plugin-emoji
2018-03-20T01:31:07.094Z [13720] - verbose: [plugins] Found 1 AMD-style module(s) for plugin nodebb-theme-persona
2018-03-20T01:31:07.099Z [13720] - verbose: [plugins] Found 5 AMD-style module(s) for plugin nodebb-plugin-emoji
2018-03-20T01:31:07.100Z [13720] - verbose: [plugins] Found 2 js file(s) for plugin nodebb-plugin-composer-default
2018-03-20T01:31:07.102Z [13720] - verbose: [plugins] Found 4 js file(s) for plugin nodebb-theme-persona
2018-03-20T01:31:07.108Z [13720] - info: [build] Building in parallel mode
2018-03-20T01:31:07.111Z [13720] - info: [build] plugin static dirs build started
2018-03-20T01:31:07.116Z [13720] - info: [build] requirejs modules build started
2018-03-20T01:31:07.119Z [13720] - info: [build] client js bundle build started
2018-03-20T01:31:07.123Z [13720] - info: [build] admin js bundle build started
2018-03-20T01:31:07.125Z [13720] - info: [build] client side styles build started
2018-03-20T01:31:07.127Z [13720] - info: [build] admin control panel styles build started
2018-03-20T01:31:07.130Z [13720] - info: [build] templates build started
2018-03-20T01:31:07.132Z [13720] - info: [build] languages build started
2018-03-20T01:31:07.135Z [13720] - info: [build] sounds build started
2018-03-20T01:31:08.093Z [13720] - info: [build] admin js bundle build completed in 0.97sec
2018-03-20T01:31:08.110Z [13720] - info: [build] client js bundle build completed in 0.991sec
2018-03-20T01:31:08.472Z [13720] - info: [build] sounds build completed in 1.337sec
2018-03-20T01:31:09.242Z [13720] - info: [build] plugin static dirs build completed in 2.131sec
2018-03-20T01:31:09.261Z [13720] - info: [build] requirejs modules build completed in 2.145sec
Witout `from` option PostCSS could generate wrong source map or do not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning
Witout `from` option PostCSS could generate wrong source map or do not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning
2018-03-20T01:31:16.914Z [13720] - info: [build] client side styles build completed in 9.789sec
2018-03-20T01:31:16.922Z [13720] - info: [build] admin control panel styles build completed in 9.795sec
2018-03-20T01:31:18.139Z [13720] - info: [build] languages build completed in 11.007sec
2018-03-20T01:31:18.149Z [13720] - verbose: [meta/templates] Successfully compiled templates.
2018-03-20T01:31:18.150Z [13720] - info: [build] templates build completed in 11.02sec
2018-03-20T01:31:18.155Z [13720] - info: [build] Asset compilation successful. Completed in 11.042sec.
[cluster] Restarting...
Clustering enabled: Spinning up 1 process(es).
[cluster] Child Process (13720) has exited (code: null, signal: SIGTERM)
2018-03-20T01:31:19.349Z [11536] - info: Initializing NodeBB v1.8.0 http://localhost:4567
2018-03-20T01:31:19.357Z [11536] - verbose: * using mongo store at 127.0.0.1:27017
2018-03-20T01:31:19.358Z [11536] - verbose: * using themes stored in: c:\dev\NodeBB\node_modules
2018-03-20T01:31:19.528Z [11536] - warn: You have no mongo username/password setup!
2018-03-20T01:31:21.795Z [11536] - verbose: [minifier] utilizing a maximum of 2 additional threads
2018-03-20T01:31:21.840Z [11536] - verbose: Checking dependencies for outdated modules
2018-03-20T01:31:22.050Z [11536] - error: Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec:
2018-03-20T01:31:22.052Z [11536] - error: ./nodebb upgrade
[cluster] Child Process (11536) has exited (code: 0, signal: null)
Judging by the last error, it looks like you'll need to run ./nodebb upgrade -s
oh sorry i forgot to add that.
c:\dev\NodeBB>nodebb upgrade -s
Updating NodeBB...
1. Updating NodeBB data store schema...2018-03-20T12:46:55.027Z [11216] - warn: You have no mongo username/password setup!
Parsing upgrade scripts...
OK | 1 script(s) found, 50 skipped
c:\dev\NodeBB\node_modules\mongodb\lib\utils.js:123
process.nextTick(function() { throw err; });
^
Error: Cannot find module './src/database'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at Object.<anonymous> (c:\dev\nodebb-plugin-session-sharing\upgrades\session_sharing_hash_to_zset.js:3:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
Oh i see the issue. so in the file session_sharing_hast_to_zest.js there is
var db = require.main.require('./src/database');
what is this? it is obvious that this file is not in the location while doing development on this plugin in a different directory.
anyway i commented it all out and just call the callback(). i assume this is all part of running the update to a newer version. i have Nodebb running in dev mode and i can see the session sharing plugin page.
I advise you to use yarn link
when working with plugins, then it is easier to handle requires :+1:
actually yarn would give the same issue.
i updated the line to
var db = module.parent.require('./database');
and it is working just fine now.
require.main.require
works just fine for me (as NodeBB is requiring session-sharing's library.js
, so that's the main
).
If module.parent.require
works for you, great! :smile:
i installed the most current version of nodebb and cloned the most current version of this plugin. went into the directory where i cloned this plugin and ran npm link went back to nodebb directory and ran npm link nodebb-plugin-session-sharing (this is the dir where i cloned the plugin into).
then nodebb dev
get an error: Your NodeBB is out-of-date. Please run the following command to bring your dataset up to spec: [cluster] Child Process has exited
i am able to run nodebb when i remove the link. os: windows. node: v8.9.4 npm: v5.7.1
any help would be great.
the reason i would like to debug this is that i would like to update this plugin to work with AWS Cognito JWT instead of a cookie.
Thanks