ElectronJS: Operation not permitted - node.js

I've been developing an Electron app for Linux. The problem is: I can't execute an instruction because of this:
Error: socket: Operation not permitted
This might mean it needs sudo permissions. But since it is a desktop app, and I want to avoid this when I'll distribute it, is there a way to bypass this error, to execute it without sudo or automatically use it, in both development and production mode? If not, can I write a message which says it requires admin execution when I open its AppImage?
#crimson589
If I run dev mode with sudo npm run electron:serve it returns Error: Failed to get 'appData' path. If I run the AppImage with sudo, it works.

Related

NX for Angular preventing certain operations from running?

With NX 14.8.1 for Angular 14.2.4, the file 'node_modules/.cache/nx/d/daemon.log' is preventing operations such as yarn install from running properly. When running yarn install, the following error is displayed in the console.
Error: EPERM: operation not permitted, unlink 'C:\Users\user\Programming\project\project2\ClientApp\node_modules.cache\nx\d\daemon.log'
Note: user, project, and project 2 are replacements for the real directories. user has a space in it, which has caused problems for nx before.
The file daemon.log does not allow me to delete it via File Explorer or PowerShell rm. File Explorer prompts for Admin but says that access is denied when I do, and PowerShell fails to run with an access is denied error. I am also unable to delete it via rm in Windows Subsystem for Linux Ubuntu, with a similar error to PowerShell rm. In File Explorer, I am unable to edit the permissions of the file to allow it to be deleted.
It seems funny but using any file unlocker would help.
I just use IOrbit unlocker to unlock and delete the deamon.log and nx build just started working.

why nodemon is throwing error that script is disabled?

I have installed nodemon globally,but while trying to run it's showing the error as in image. What to do? Also my node js and projects are in different drives.
There are many of this type issues when you search for them. The best guide I found is:
https://dev.to/thetradecoder/how-to-fix-error-nodemon-ps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system-34fe
Step 1:
Open Windows PowerShell with Run As Administrator.
Step 2:
As you see the error is about_Execution_Policies, first to see what's there in the present execution policy. Use this command on Windows PowerShell to get it
Get-ExecutionPolicy
Here you'll see 'Restricted'. So, this is the main reason- running scripts on this system is 'Restricted'.
Step 3:
Now we need to change this policy to allow the operation. Use this command to make it Unrestricted -
Set-ExecutionPolicy Unrestricted
Here you'll get a prompt message. Press Y to change it
That's it. To ensure, you may check the execution policy status by this command again
Get-ExecutionPolicy
You'll get the output 'Unrestricted'
The problem is solved. Now you can use nodemon on your machine.

How to debug your application with root permissions on VSCODE?

I'm trying to debug dotnet core web app, however it's not possible to do it without having root permissions.
An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.Private.CoreLib.dll: 'Permission denied'
The naive approach would be launching VSCode with root permissions, which is generally not a recommended (and I would like to avoid it).
Is there any way to configure launch.json to execute the debugger with root permissions?
I've tried already creating a pre-launch task executing sudo or sudo su commands.
I tried running the application and trying to attach to the process (also got declined because of insufficient permissions)
For C#:
Locate vsdbg-ui (in my case: ~/.vscode/extensions/ms-dotnettools.csharp-1.23.17/.debugger)
Rename "vsdbg-ui" to "vsdbg-ui2"
Create a new file in the same folder called "vsdbg-ui" with following content:
pkexec [yourhomefolder]/.vscode/extensions/ms-dotnettools.csharp-1.23.17/.debugger/vsdbg-ui2
Make the new file "vsdbg-ui" executable
Launch the debugging session in VSCode. You will get a prompt to enter your sudo password. You are debugging with sudo now.

why can't i run meteor in root mode?

I am installing meteor by shell script in root mode. When I try to build app it is prompting
*You are attempting to run Meteor as the "root" user. If you are developing, this is almost certainly not what you want to do and will likely result in incorrect file
permissions. However, if you are running this in a build process (CI, etc.) or you are absolutely sure you know what you are doing, add the --unsafe-perm flag to
this command to proceed.*
I am running other things with shell script which needs root mode. Any help appreciated
You are attempting to run Meteor as the "root" user.
If you are developing, this is almost certainly not what you want to do and will likely result in incorrect file permissions.
However, if you are running this in a build process (CI, etc.) or you are absolutely sure you know what you are doing, add the
--unsafe-perm
flag to this command to proceed.

Archlinux ARM: Error: failed to init transaction (unable to lock database)

So i am new to arch linux and i am following a guide to get KDE plasma installed, so i've go going along through this script and now all of a sudden i get the following error:
Archlinux ARM: Error: failed to init transaction (unable to lock database)
error: could not lock database: read-only file system
and the command i am using is:
pacman -S kf5 kf5-aids
Now from the fact that i know how to read i see that the second error states that all files are currently read only. What i want to know is how or what would have caused that to happen and how to fix my all round issue.
Do you have root privileges?
Try sudoing:
# sudo pacman -S kf5 kf5-aids
If you haven't installed (and configured) sudo, just log in as root:
# su -
And execute the command under the new user.

Resources