'npm ERR! Please try running this command again as root/Administrator' => Worked in one terminal but not the other => WHY? - node.js

I am using Visual Studio Code to create a REACT application and when using the built in terminal I received the error message below and it failed to add the dependency (npm install fixed-data-table)
npm ERR! Please try running this command again as root/Administrator
Instead, I opened the Node Command Prompt and ran the same install and it worked!
Just curious as to why this happened if anyone knows as I'd much prefer to use the built in terminal.

Since VS Code is an application, it doesn't have the same pre-existing rights as the Node Command Prompt specifically it isn't an "administrator" account. If you want to use the powershell in VS Code for everything though, try launching VS Code as an administrator (right click on the logo and click run as admin)
Source: https://github.com/Microsoft/vscode/issues/7407

This error can also occur due to file locks, possibly from having multiple instances of the project loaded. I ran into this when I had the same project loaded in both Visual Studio and VS Code.

Related

Error detecting Nodejs when trying to install "Codux" on windows

While trying to install Codux (https://www.codux.com) on Windows 10, I am facing this issue where it says: "node -v" failed with error. I have node v19.4.0 installed. Can you kindly help me understand what might be causing the issue.
Codux is querying for the node version using cmd.exe (Command Prompt)
when executed on Windows.
Can you please check whether executing node -v
in Command Prompt returns the same version as PowerShell?
It can be
launched via opening the Start Menu and typing "command prompt" in the
search.
In addition, could you clarify how was Node.js installed? was it via the official installer, or perhaps nvm for windows?
For followup, we suggest you join us on Discord at: https://discord.gg/fg3Ywsa44N
Or you could contact our support at: https://help.codux.com/kb/en/contact
Thanks in advance,
The Codux Team

How to run a command in Developer command prompt 2019 using Python

I'm trying to do build in Developer Command Prompt of VS 2019 using Python script.
Here is piece of code i'm using:
import os
os.system('start /wait C:/Windows/System32/cmd.exe "msbuild C:/Users/Desktop/Project/Project.sln"')
os.system("pause")
But it is not working.Developer command prompt is appearing for just 1sec and disappearing .
When i took variable to check if command was succesful or not ,it is giving variable result as zero,which means command is successful but i'm not able to see it in Developer command prompt.
result= os.system('start /wait C:/Windows/System32/cmd.exe /k ipconfig')
print (result)
Whereas when i'm trying the same command in windows command prompt it's working fine.
How to run a command in Developer command prompt 2019 using Python
Developer command prompt 2019 is a tool which is integrated into VS2019 IDE and provides environment parameters for various development modules.
However, the CMD.exe does not have these environment variables for these, so you cannot just use CMD.exe directly. Sorry that I am not familiar with python code and script. I suggest you could configure Developer command prompt 2019 into System environment variable PATHand then call cmd.exe which integrates the related variables to build your projects without any errors.
Suggestion
First, if you build your project on another new agent, you should install one of tool from step 1.
1) If you install VS2019 IDE in your local agent,please make sure that your local agent has VS2019 IDE and install the related workload about your project type.
Besides, if you install Build Tool for VS2019, please also install the related workload.
2) set the below path under System environment variable PATH
VS2019 IDE:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
Build Tool for VS2019:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
3) Then you can call your python script as you described to build your projects.
Any feedback and concern will be expected.

Electron build for windows shows sqlite3 error. But same build for Ubuntu Works

Packed using: Electron-Packager
Database: sqlite
The app uses Knex as a driver to query to mysqlite.
The module which it says that it cannot find is already present! But then too the error shows up.
I tried to navigate to the resource/app and then use commands like
npm run rebuild
tried installing python, node and then tried but seems like it required some CL.exe file so had to dowload Visual Studio C++ packages too but unfortunately it didn't have that file in my case.
Also tried
npm install sqlite3 --build-from-source
but got error
Can anyone help me with the exact steps to take? I also need help in knowing do i have to take this steps on the package that is already build or before i build it?
The best possible fix i got is the build the system in windows and then deploy it for windows. You need to google at every step where it breaks and then fix it. There are many possibilities and hence i cannot describe it here.

gulp integration in Visual Studio 2017 not working

I'm attempting to get gulp integration into Visual Studio 2017. It's working on the command line. The Task Runner Explorer in VS2017 is telling me Failed to load. See output window.
The Output Window is telling me the following:
Failed to run "<ProjectPath>\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
<ProjectPath>\node_modules\node-sass\lib\binding.js:15
throw new Error(errors.missingBinary());
^
Error: Missing binding <ProjectPath>\node_modules\node-sass\vendor\win32-x64-47\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 5.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 8.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
I attempt to run npm rebuild node-sass --force, only to be told Error: Can't find Python executable "C:\Python36\python.EXE", you can set the PYTHON env variable., which I confirmed existed.
I'm not sure how much farther I want to go down this rabbit hole. It appears to be a VS issue since everything works as expected on the command line. I'd like to get the gulp integration with VS working correctly.
Point your VS tools to the node installation on your path.
I can see in the error that there a version discrepancy between 5.x and 8.x - with VS likely being the older one (since it ships with pre-packaged and outdated node) and is taking execution precedence with the default setup.
I'm guessing you installed node-sass via your 8.x (external command line) instance but VS is trying to execute your gulp tasks via your VS's internal 5.x. node-sass leverages node-gyp to build a binary via installation scripts, and there will be incompatibilities across versions. In other words, this package, and many others that build binaries, are specifically tailored to the version of node it was installed against. To summarize, everything in node_modules/.bin is built against 8.x but is actually running on 5.x when you do so through Visual Studio.
Fear not, this is easily solved. Check out this answer for some historical context on this long running issue that many face. Basically, you want $(PATH) to be at the top of this list so your OS installation is always used...
Once you do this (just to be safe) - blow away node_modules, reinstall, and happy coding. VS really needs to stop shipping with pinned versions of node...
I ran into this problem on both Visual Studio 2017 and 2019. Apparently my Node install wasn't registered in the PATH variable (and I don't have permission to modify this on my work machine), so I manually added the link to Node at C:\Program Files\nodejs, moved that to the top location and that worked for me.
This drove me nuts until I found one more missing thing. Even if you configured everything as in the other answers you can get the same error, possibly if your user folder is not on the same drive as where Node is installed. Then also add %APPDATA%\npm to the external tools paths so globally installed Node tools will be found too.
So all in all the external tools config in VS should contain these two paths first, in this order:
C:\Program Files\NodeJS (or where you have Node installed).
%APPDATA%\npm
For me without #2 everything was working from the command line everywhere but not in VS. With it added everything now works in VS too.

Error executing action install on resource 'windows_package[Node.js]'

I am trying to install workup in my parallels in Mac Book Pro.
I tried the command workup on powershell (in Administration Mode).
But when I run this command it throws this error as shown below and because of it I am not able to continue my further installation.
Error executing action install on resource 'windows_package[Node.js]'
I am also adding the snapshot of the error . So, please refer to it as well.
The problem is solved by uninstalling the node.
There was mismatch in node versions.
So, I uninstalled node from the system and workup itself install's node and it works after this.
Thanks :)

Resources