Weird "EINVAL" bug while trying to install plugin
-
Hey y'all.
Been trying to setup this software for forum. I liked that it has better customization but I have been getting this freakin' bug whenever I try to install any plugin via admin panel. Happens for all of 'em plugins. Does anyone know about this?
Tried looking many places for fix before finally decided to post here. Folder has all the write, read, execute permission.Would really appreciate y'all response.
Thanks!!
BUG:
-
Hi @baris , thanks for the response. It is version 20. Yea, I stumbled upon that thread as well before while looking for solutions.
Edit: That's the latest version I believe. If I need to use some other version, how to make sure that the Nodebb forum processes is using the older ones? I use nvm for switching versions. Thanks!
Edit2: Downloaded and used latest version, which is 22 apparently. Still same error
What node version do y'all use? Cheers!
-
I am just starting with node. I am not sure where to include it. Where do you edit that stuff, do you know?
Edit: Looked into it further, and tried this in cmd itself. Not sure if anything changed but still getting same error.
-
Yea, the output for version was 10.8.1
Offtopic: Can you give me 1 rep? I need to wait before posting .... takes 5 mins per post. Would appreciate it. Thanks.
-
No, giving the same error.
Edit: thanks for rep.
-
Just tried that. It doesn't show any error on response. Tried rebuilding and installing any plugin, same error though.
-
Yeah because when you try it inside nodebb it doesn't pass
{ shell: true}
to the command, try adding it to nodebb here https://github.com/NodeBB/NodeBB/blob/master/src/plugins/install.js#L122.cproc.execFile(packageManagerExecutable, [ packageManagerCommands[packageManager][command], pkgName + (command === 'install' && version ? `@${version}` : ''), '--save', ], { shell: true }, (err, stdout) => {
Although if we do this we need to make sure
pgkName
is sanitized. -
I will try that. This is very unique error and I wonder why am I the only one getting it in this entire forum. I don't find anyone else facing similar issue with NodeBB. Do you think I should instead re-setup the entire software?
EDIT: It installed this time from Admin panel. However, while trying rebuilding, got the following error. It apparently deleted my custom-theme from node_modules directory for no reason? Crazy. Thank god I had a backup.
nodebb build started 2024-06-20T20:42:02.581Z [4567/33928] - warn: You have no mongo username/password setup! 2024-06-20T20:42:02.610Z [4567/33928] - error: [build] Encountered error preparing for build 2024-06-20T20:42:02.611Z [4567/33928] - error: [build] Encountered error during build step 2024-06-20T20:42:02.611Z [4567/33928] - error: Error: theme-not-found
-
So, after restoring my backup of 'custom theme' into node_modules, it is building and starting AND the plugin is there. But looks like every time I install any newer plugins, I will have to restore the custom theme in node_modules. I wonder if this is a bug and anyone else has experienced it as well.
Edit: Ah! I just realized, it could be that everytime the plugin is being installed, it uses package.json of the plugin but this also 'reinstalls' everything from package.json in root directory. Since the custom theme isn't there in package.json as dependencies, it just deleted it. That's what I can think of. Do you think that's what might have happened?
-
Thanks Baris. This has been really helpful understanding the build of this software. Just one more question, you said about sanitizing package name. Now that {shell : true} has been added. Do I need to another extra step to install plugin? What's sanitizing? Thanks man.
@baris said in Weird "EINVAL" bug while trying to install plugin :
Although if we do this we need to make sure pgkName is sanitized.
-
oh nice. thanks.