Weird "EINVAL" bug while trying to install plugin
-
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.