How to fix npm Error "timed out" after npm update - windows

We have a React app, based on the Hydrogen theme for Shopify (which uses vite). It was all working ok until I had to add a package and update. It then started giving the following message: Error timed out. That is it, no other error message, I looked in the logs and there was nothing remarkable in there.
I tried removing the package, and all references to it in the code. But it looks like the issue may well have been the update command. But being rather new to React and npm on Windows, I have no idea how to fix it. Things that I did try were clearing the cache using:
npm cache clean --force
Doing another update. Removing the lock file.
Does anyone have a suggestion as to a method to debug that one-line error code, or could point me in the right direction? I am running on localhost, via Windows 10.
npm error timed out image

My problem must have been a broken dependency. After a day or so of trying updates, it eventually just started working again. The update that actually worked had some vulnerabilities, so I ran an:
npm audit fix
After the npm audit fix, the code started running correctly again.

Related

My vsc code disappeared and I have no idea why or where it's gone

I was working with discord.js last night and I ran a few commands in the terminal. The last command I wrote caused the name of the file at the top of the screen to be crossed out and turn red and I followed the path to where the file was and it was gone. I've checked the recycling bin and nothing was there. The file has left no traces and the project is gone. Is there any way that I can get the code back?
The commands I ran were -
npm update,
npm audit,
npm audit fix (the one that caused the file to disappear)
My file was also within the node_modules folder which probably explains why it disappeared when I ran those.
Any help is appreciated, thanks.
Yes, apparently this happens sometimes, especially when there is update on restart (see here https://github.com/microsoft/vscode/issues/52855). For some reason the software is moved to
C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\_
where <user> is your username.
If you start from there it goes as always. I didn't try any move or rename, just reinstalled the last version and everything went back to normal. This is first time happening to me, and according to most reports it doesn't happen often enough to be a problem, however a few users report it to have happened tens of time, that I understand being an annoyance.
If the file that got removed was inside the node_modules folder there's no problem. You can just remove the node_modules folder and run npm install . That will fix the problem.
If there is not package.json file in your project, you can still remove the node_modules folder but then you need to install every dependency manually like this: npm install <module_name>.

How do I see all the warning raised by yarn during project installation again? Is there a command for that?

I got a lot of unmet peer dependency errors during a project installation using yarn. And I didn't take a screenshot of those or anything. How do I see all those warning again? Is there a command for that?
The following command works while using yarn as the package manager:
yarn install --check-files
This sort of worked for me: yarn --ignore-scripts --audit.
I think it showed a few less warnings than when I ran a fresh install, but it is at least showing some of the previous warnings for me. I threw --ignore-scripts in there because in Nx/Angular repos, you might have a lengthy ngcc command set up in your package.json. --audit's main purpose is to actually show you how many vulnerabilities you have in your dependencies, but as a side-effect, it appears to be running whatever code shows the warnings. If there is a better solution, I'd also like to know.

Cypress doesn't create directory on install

I did have Cypress working at one point with 4.12.1, then upgraded to 5.0 and updated a couple of npm packages identified by npm-check-update. Now it refuses to start at all, it just hangs with Starting:Cypress displayed.
I tried my best to uninstall and remove all trace of cypress, even deleting the cache directory before installing the new version (either 4.12.1 or 5.0).
But every time I install it, even in a new project directory, it no longer creates the cypress directory. I think if I can find out why that isn't happening it will somehow be related to the original problem.
When I try to start with 'npx run cypress', I get the following:
Starting: cypress
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'D:\inSight_HEAD\Web\Frontend\Apps\Test\cypress'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I even went so far as to revert my (Windows 10) machine back to a system save point from yesterday when it was working, having to reinstall my web browsers afterward, but it didn't help.
Thanks for any ideas on how to proceed. I've only been using cypress for a couple of days, had written a few successful tests, but now it's come to a screeching halt and I've spent an entire day just trying to get it to run at all.
Thanks Alapan, that was it. Somehow I got confused and kept trying to run 'npx run cypress' (which either doesn't create the directories, or if the directories do exist it hangs forever on Starting: cypress), when I should have been running 'npx cypress open' or 'npx cypress run'.

React native app stopped to work after git pull command

I've an app developed using React Native, everything was ok at the begin, but at certain moment the app started to raise this error on iOS:
something went wrong initializing native ReactNativeLocalization
Now, the only thing that i've did is to delete the project, re-get it from git, execute npm install, react-native link, pod update, pod install, and build again(using the .xcworkspace file).
If I install manually ReactNativeLocalization a different error will raise:
undefined is not an object (evaluating 'RNGestureHandlerModule.State')
If I install also react-native-gesture-handler the will crash at the immediately at the startup
I've tried to pull very old version, but everyone of it do the same errors...
There is so much code, I don't know which code could be useful in this case.
I expect that, after re-pull a working version, the app have no errors.

Composer TransportException translation file could not be written

I am installing laravel 4 and running "composer install" command. It was able to install 13 packages successfully, but when it came time to install symfony/translation, it downloaded it 100% and then threw an error:
[Composer\Downloader\TransportException] The "https://api.github.com/repos/symfony/Translation/zipball/6bc4b753c1ae5640c0eacdbe27c04a69cde3d10d" appears broken, and returned an empty 200 response
Could it be because the original is 0 bytes? Is there a work around to installing this package?
Dropping in to confim that I'm seeing this too so I guess I can stop panicking now as it seems to be an error somewhere between Packagist and Github (still a problem to my boss but something to be said for it not being your fault!)
edit: I'm having this issue with kriswallsmith / assetic running Symfony 2.1.9
update: Received an email from Github support indicating this is an issue that they are aware of and are actively looking into it.
I've just added the '--prefer-source' flag until the issue is resolved on their end.
I had this problem for twitter bootstrap:
[Composer\Downloaded\TransportException]
The "https://api.github.com/repos/twitter/bootstrap/zipball/v2.3.1" file could not be written to /my/path/Symfony/vendor/twitter/bootstrap/e01f28f3c03a11c104bae8d4a1b59d21.1:
Doing "composer self-update" changed it to:
[Composer\Downloader\TransportException]
"https://api.github.com/repos/twitter/bootstrap/zipball/v2.3.1" appears broken, and returned an empty 200 response
Using "composer update --prefer-source" seems to have installed it properly.
So it looks like github zip file download is broken.

Resources