Electron fails to install on CI - javascript

After we migrated to Electron v11 for our project from v6, we started experiencing weird CI issues, where Electron did not install properly and the pipeline failed.
Our setup:
Lerna
Monorepo
Yarn v1.22
Private npm registry
Example of such issues:
[4/4] Building fresh packages...
error /builds/xxxx/..../node_modules/electron, /builds/.../node_modules/electron, /builds/xxxx/app/node_modules/electron: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /builds/xxxx/features/yyyy/node_modules/electron
Output:
Error: dest already exists.
at /builds/xxxx/node_modules/fs-extra/lib/move/move.js:41:31
Exit code: 1
Command: node install.js
Arguments:
Directory: C:\gitlab\builds\pFMTxHs3\0\xxxxxx\features\yyyyy\node_modules\electron
Output:
C:\gitlab\builds\pFMTxHs3\0\xxxx\features\yyyyy\node_modules\electron\install.js:51
throw err
^
[Error: ENOENT: no such file or directory, open 'C:\Users\xxxx\AppData\Local\electron\Cache\httpsgithub.comelectronelectronreleasesdownloadv7.1.4electron-v7.1.4-win32-x64.zip\electron-v7.1.4-win32-x64.zip'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\xxxx\\AppData\\Local\\electron\\Cache\\httpsgithub.comelectronelectronreleasesdownloadv7.1.4electron-v7.1.4-win32-x64.zip\\electron-v7.1.4-win32-x64.zip'
We tried deleting CI caches, Yarn caches, NPM caches all of that worked inconsistently. Sometimes we would have successful pipelines, sometimes not.

After a couple of months battling with this ghost, we had another error 5xx upon trying to download electron. It suddenly stopped downloading everywhere local machines and CI.
After getting in touch with the Electron team I discovered the problem.
We had a very old .npmrc config, which was no longer valid.
It contained this:
disturl=https://atom.io/download/electron
When I've changed the line into this:
disturl=https://electronjs.org/headers
All of our pain was gone - our builds became stable again.
Big thanks to the electron community!

Related

Program 'npx.cmd' failed to run

I'm trying to create a JS app using the VSCode Terminal. To do so, I'm typing in the following: npx #knowledgehut/create-js-app my-blog but I get the following error as a result:
ResourceUnavailable: Program 'npx.cmd' failed to run: An error occurred trying to start process 'C:\Program Files\nodejs\npx.cmd' with working directory 'C:\Users\belen'. The system cannot find the file specified.At line:1 char:1
npx #knowledgehut/create-js-app my-blog`
I have already unistalled an reinstalled VSCode and same with Node.js. I have of course restarted my computer because sometimes that does the trick but nothing worked.
VS Code version: Code 1.69.2 (3b889b0, 2022-07-18T16:12:52.460Z)
OS version: Windows_NT x64 10.0.22000
Restricted Mode: No

build failed react-native 0.6.5 We ran "xcodebuild" command but it exited with error code 65

I'm having this problem "error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening starter.xcodeproj. Run CLI with --verbose flag for more details." since I pulled the latest update from the other colleague, I can't run the project in my simulator, but my colleagues side works fine.
I've tried to change the build system to legacy build system.
Clone the project again.
remove the build folder under iOS folder, and run again.
remove the node module folder and run again.
I have tested in different device is not working too.
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening starter.xcodeproj. Run CLI with --verbose flag for more details.
User defaults from command line:
IDEDerivedDataPathOverride = /Users/nexplatform/Desktop/padini scm mobile/SCM/ios/build/starter
brew install cocoapods
cd projectfolder/ios
pod install
and
cd..
react-native run-ios

vscode-ripgrep not getting installed in VSCode build/run process

I was trying to build and run VSCode on my Ubuntu 17.10 using the following guide: https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run
When I tried to install dependencies using yarn, it is giving me the following error:
error /home/dhairyakhale/git/vscode/node_modules/vscode-ripgrep: Command failed.
Exit code: 1
Command: node ./lib/postinstall.js
Arguments:
Directory: /home/dhairyakhale/git/vscode/node_modules/vscode-ripgrep
Output:
Unzipping to /home/dhairyakhale/git/vscode/node_modules/vscode-ripgrep/bin
And then it stops the process. How do I proceed?
I have a similar issue while installing Theia. The broken vscode-ripgrep installation caused it. Here is the ticket I submitted to vscode-ripgrep.
https://github.com/roblourens/vscode-ripgrep/issues/15

All npm commands giving same error (ENOENT)

I'm using windows 8.1 x64 with all updates.
I was using nodejs 8.9.1 - I took an error on command "npm -v".
So I uninstalled this version and install 8.9.3. It gave me same error on the command.
And then I uninstalled 8.9.3 and clean all paths using this answer;
https://stackoverflow.com/a/20711410/1143249
Then installed new version 9.3.0...
But still, I'm getting same error in all npm commands.
What am I missing? How can I solve this problem?
C:\Users\UserName\Desktop>npm -v
Error: spawn C:\Program Files\nodejs\node.exe ENOENT
at _errnoException (util.js:999:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
at onErrorNT (internal/child_process.js:389:16)
at process._tickCallback (internal/process/next_tick.js:152:19)
at Function.Module.runMain (module.js:703:11)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3
C:\Program Files\nodejs\node_modules\npm\lib\npm.js:51
throw new Error('npm.load() required')
^
Error: npm.load() required
at Object.get (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:51:13)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
at process.emit (events.js:159:13)
at process._fatalException (bootstrap_node.js:387:26)
5.5.1
events.js:136
throw er; // Unhandled 'error' event
^
Error: spawn C:\Program Files\nodejs\node.exe ENOENT
at _errnoException (util.js:999:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
at onErrorNT (internal/child_process.js:389:16)
at process._tickCallback (internal/process/next_tick.js:152:19)
at Function.Module.runMain (module.js:703:11)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3
Update:
Everytime I uninstalled nodejs, clean/delete folders and tried these versions;
- node-v9.3.0-x64 not working
- node-v8.9.3-x64 not working
- node-v8.9.1-x64 not working
- node-v8.9.0-x64 not working
- node-v7.10.0-x64 shows version number also a small error.
Here is the output;
C:\Users\UserName\Desktop>npm -v
5.6.0
events.js:163
throw er; // Unhandled 'error' event
^
Error: spawn C:\Program Files\nodejs\node.exe ENOENT
at exports._errnoException (util.js:1050:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3
Update:
I uninstalled Avg anti-virus protection and installed node-v6.12.3-x64.msi. Still I have problems, an example; I can't run commands like;
Last Update
Thanks for all answers ( until this date: 10.02.2018 03:30 PM GTM+3 )
( I've completed some of my jobs with vm windows until this date but now I've sad news.)
I ran out all options and I have still a lot work to do with npm packages.
So, I've formatted my machine and replace with Windows 10 Enterprise x64.
I can't try new answers now but here is golden point what I've learned;
If you have mission critical machine like ci-build (jenkins etc.) or
if you don't have more than one computer (And vm is not an option)
Just backup your drive completely at time to time because you will never know
your computer softwares (like node - npm) could give an interesting errors such as this. That's what I learned, just saying...
The workaround is to ensure that C:\Users\{user}\AppData\Roaming\npm exists and is writable with your normal user account.
see Troubleshooting
Although haven't tested Node on Windows 8, I suggest you get rid of npm installation under AppData folder altogether. You can achieve this by using a Node version manager. I recommend Nodist. You can easily switch between versions as well.
With Nodist you can run the command as such:
nodist 6.2.10
One of the things I suspect is Node runtime's limited access to required files under C:/ drive - maybe something related to Windows 8. That said, you could install nodist in any drive other than C:/. Meanwhile as mentioned by #fjoe, stick with LTS versions especially v6.x.x.
Here are a few things to consider when picking your node.js version.
Version labelled as LTS (Long Term Support) are the releases they stand behind.
You can see a full list of versions here notice the LTS column. It is also interesting to see the versions of V8 and npm that are packaged with each.
Node 9.* has no official LTS release.
Node 8.* officially entered LTS on 10-31-2017 (3 months ago).
I personally have run into problems with it.
Node 7.* never officially released as LTS.
Node 6.* has 2 years of official LTS releases and they are continuing to support it.
With the most recent release on 01-02-2018.
Given this information might I recommend you try the proven long supported version 6.*
If this works then maybe hold off on version 8.* until more things get ironed out.
Other people have commented on your question about environment variables for node or npm. This is obviously not the issue as the commands are recognized and running (but they error).
Also I would recommend you follow this full uninstall guide: How to completely remove node.js from Windows
My coding buddy had a similar error yesterday, although on Linux.
The error was in the node_modules folder, so removing that and reinstalling node solved it for him.
That would be your node_module folder in AppData\Roaming\npm.
I guess the problem can be in NPM itself.
try to update your NPM.
Try to use this great approach
By the way, it's great to know what npm version you have with your changes of node.js versions.
From the logs you provided it looks like a cache bug, because of some junk that previously exists and that is causing issues.
Open the command prompt with admin privileges and follow the below steps:
1) Clear the cache: npm cache clean --force. You can also run npm cache verify.
2) Delete node_modules folder using: rm -rf node_modules.
3) Delete any package-lock.json file.
4) Remove the .npm directory.
5) Remove following directories :
5.1) C:\Users\<username>\AppData\Roaming\npm\.
5.2) C:\Users\<username>\AppData\Roaming\npm-cache.
6) Also, Try by setting environment variables:
C:\Users\<username>\AppData\Roaming\npm;C:\Program Files\nodejs.
Type in the command line: which npm.
Maybe you did not set the system value : NODE_PATH it should point to your global module location.
7) Update to the latest npm with npm i -g npm#latest.
Hope the above trick resolve your issue.
Thanks.
I guess while installing Node.js it don't able to set it's environment path due to permission.
You Need to configure Node path manually into environment variables.

Error message from "jspm install jquery"

I am working through the tutorial on the jspm.io site
https://github.com/jspm/jspm-cli/wiki/Getting-Started
All works fine until I get to item 3, where I try to execute
jspm install jquery
and I get this error message
warn Error on getOverride for jspm:github, retrying (2).
ReferenceError: ui is not defined
at c:\Projects\Project1\node_modules\jspm\node_modules\jspm-registry\registry.js:157:5
nodejs is v0.12.0
npm is 2.5.1
jspm is 0.14.0
and this is on Windows 8.1
Does anyone have any clue what is causing this?
This looks like it was because there was an error while jspm was trying to create the local registry clone. Ensure you have git installed as git on your machine. Otherwise it may be a permissions issue.
This was a logging bug though - have fixed it with an update to the registry, so that the error should be slightly more useful next time if you update jspm.
I was getting a similar error with jspm but my problem was actually in how nodejs child_process.exec was calling the git command.
child_process.exec was running
C:\Windows\system32\cmd.exe /s /c "git clone --depth=1 github.com/jspm/registry.git .
However cmd.exe was still auto running commands set in the registry first. In my case the command changing the working folder. So the cwd was being overridden.
Check your registry settings for:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
If there is a command in there to set the drive of working folder it will cause the above error.
Also
With your working folder as c:\, try ruuning the following nodejs code:
var exec = require('child_process').exec;
exec('dir', { cwd: 'C:/windows/fonts' }, function(error, stdout, stderr) {
console.log('stdout: ' + stdout);
});
If it does not list the contents of the fonts folder then your problem is more likely with child_process.exec in node

Categories