The imported project "C:\Microsoft.Cpp.Default.props" was not found - npm

When trying to npm install node-sass on a new virtual machine I'm getting this error:
The imported project "C:\Microsoft.Cpp.Default.props" was not found.
I've tried multiple solutions as follows:
Installing the VS Build Tools
installing either LTS, or Current Node.js version.
Adding/Setting the VCTargetsPath variable in the registry.
Looking for the MSBuild folder (which I don't seem to have)
Yet nothing's worked.
The odd thing is that my old computer can install and run node-sass just fine without having that variable or folder either, so I'm not sure what exactly is the cause of this.

I am not a cpp user first of all. But I have got some links that might help.
npm install -g karma error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found
Secondly, you can try looking for the MSBuild folder in this location, as it was in mine.
Location: C:\ProgramFiles(x86)\MSBuild\Microsoft.Cpp\v4.0\V120.
Hope it helps :D

Related

Why is preact not getting recognized in the terminal even after installing it?

I have installed Preact but it’s not getting recognized in the terminal. First, I went to the official website of PreactJS. The doc says that I have to run npm install -g preact-cli. As I am using Yarn, I ran yarn global add preact-cli. It was installed successfully but with a lot of warnings. Then I ran preact create default first-preact-app. But it's showing an error that "The term 'Preact' is not recognized as a name of a cmdlet, function, script file or executable program."
I have tried force cleaning the cache and reinstalling preact-cli. But it doesn't work. Two of the warnings are that preact and preact-render-to-string have unmet peer dependency. So, I have installed them also. But it still doesn't work.
I have tried running npm and experimented with the commands also. But it didn't work. So, how can I fix the problem?
I have run these commands using Powershell and Git bash on Windows 10. I am trying to install Preact 10.5.12 using Yarn 1.22.5. And a point to be noted, I tried running yarn dlx but it returns an error that "command not found". And when the installation of preact and preact-render-to-string gets finished, yarn gives and warning that they have no binaries.
EDIT: Perhaps, it was a problem with Windows. The problem has gone after reinstalling it.
Your problem almost certainly is that preact-cli was not on your PATH - a list of programs that are globally accessible.
For what it's worth, we don't recommend installing globally. The site may still say that but the repository correctly recommends using npx instead.

ERROR: Could not find plugin "proposal-private-methods". Ensure there is an entry in ./available-plugins.js for it

When trying to run yarn dev and I am getting the following error:
Error: [BABEL] C:\Users\User\OtherFolders\src\index.js: Could not find plugin "proposal-private-methods". Ensure there is an entry in ./available-plugins.js for it.
I have "#babel/plugin-proposal-private-methods": "7.8.3" as a dependency on my package.json file. Also, the #babel/plugin-proposal-private-methods folder is present in the node_modules folder.
I had tried the following to no luck:
Adding a resolution: "#babel/compat-data": "7.10.1" to the package file
I remove the node_module folder, yarn-lock, and package-lock files before attempting to run yarn install. yarn install runs without issues
I also try $ npm i #babel/plugin-proposal-private-methods
Any ideas on what the error could be or potential solutions? Thanks in advance for any help!
Kudos to the Babel Project GitHub team to help to solve the issue. The issue solution is to change the version of #babel/preset-env from 7.8.6 to 7.8.7 or higher. The response to this ticket in GitHub is in this link.

Where does npm store module when loading directly from github?

I have found a react-native module I would like to use. It contains an error which prohibits the installation.
I have forked the repository and corrected the mistake.
Now I want to install my module in order to use it, however during execution of the post installation scripts I get an error - file not found.
I have tried to find the reason for it, but the reason is quite simple, the module is not in the node_modules directory, and when npm tries to "enter" there to run the scripts, it can't find them.
I have tried to check where this is installed, but I can't.
I use npm install <user>/<repo> to install my module.

Electron Atom - Module "Node-Windows" not found after compiling

After hours of searching and still not finding a usefull answer, I hope somebody could help me with following issue that I'm facing:
I inclued to my Electron APP a module called "node-windows" so I could register a script as a service to a windows machine.
I've installed it over the command
=> npm install -g node-windows
and linked it to my project path with:
=> npm link node-windows
However if I try to compile my Project with EPI with or without asar source packaging, and start up the compiled EXE, I'm getting following error from the DeveloperTools:
Uncaught Error: Cannot find module 'node-windows'
As long the project isn't compiled yet, everything works fine.
I already checked that the module is linked to the folder node_modules in the APP Directory as also in the npm folder in the AppData directory.
What could I've been missing or what could I check to get this working?
Thank you already very much for an answer
Ok here my Solution. Guess this was an absolutely noobie mistake ^^
I've forgot to include the module to the package.json file.
I did this with "npm install -g node-windows --save-dev" & "npm install -g node-windows --save".
After that it worked.

Can't run npm after installing

I've seen many similar posts on this here on SO but for some reason those solutions don't seem to work for me. Clearly I'm missing something.
I installed depcheck package globally by running npm install -g depcheck which ran fine without any errors.
If I go into the global directory for npm packages which is:
c:\Users\<Username>\AppData\Roaming\npm on my Windows 10 machine, I do see the depcheck.cmd file.
I also see the depcheck folder within c:\Users\<Username>\AppData\Roaming\npm\npm_modules folder.
I think this means I was able to install the depcheck package globally.
When I run npm config get prefix, I get c:\Users\<Username>\AppData\Roaming\npm which seems to be the correct path.
Why is it that when I run depcheck inside my project's root folder where the package.json is located, I get:
'depcheck' is not recognized as an internal or external command,
operable program or batch file
If I try another standard npm command inside my project's root folder, it works fine. For example, I ran npm -v and got the version number.
What am I doing wrong?
I also had this problem before. After searching on the web I found that reinstalling NPM with Administrator permissions worked for me, as the installer without Administrator permissions doesn't create/write to some specific files. I hope this will help for you.
Pascal.