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

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.

Related

ng-zorro Error: Module not found when trying to run project

I'm using ng-zorro v14.1.1 for my angular 14.2.7. But when I try to run my angular application, I got errors when building the project looking for modules from ng-zorro and identifying it as not found even though the files existed in the project.
Here's the full view of the error:
Additional detail of the project:
Angular Electron project
Angular 14.2.7
Electron 21.2.0
Thanks in advance for helping!
I tried removing node-modules and re-install ng-zorro-antd using ng add ng-zorro-antd, and even npm install ng-zorro-antd if it makes a difference but to no avail, I'm still having the issue. Thus, can't run the project.
I have solved my problem. What I did was to install the modules that are mentioned in the error:
I ran the commands:
npm i d3-zoom --> this command gives you hint on what to do next when you're trying to run the project after the installation is finished, and it instructed me to run the next command below:
npm i --save-dev #types/d3-zoom
npm i dagre-compound
npm i d3-shape

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

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

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.

Bamboo build fails because webpack donesn't find node_modules

I have configured my project on angular 1.7 with webpack. In local when I run the task npm run build (launchin webpack) everything goes correctly.
But I have a plan for my CI bamboo and when a run the NPM task with npm run build I got a message, which said:
Error: Cannot find module './yargs'
I have the intuition that webpack is not able to reach the node_modules or is not in current directory.
But node_modules is installed and yargs is there after making the npm install task before.
if I run a script before the npm run build with just "ls -l" command I get:
node_modules
package-lock.json
package.json
src
webpack.config.js
So the folder is there.
Any idea where I can take a look?
I found the solution for the issue. In the Source code checkout configuration the "Force clean build" has been checked and now the build succed.
I'm not sure why, but there must have been a conflict with a previous node_modules.
The spelling of the file that you're referring is case-sensitive when building via bamboo
building locally wouldn't give you any error nor warnings in the console.
I encountered this issue with a local file (not a node_module)... Hoping this would help someone in the future;

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.