I have a create-react-app project that works well. However, if I let it sit for a couple days—without making any changes—it always breaks, with the error
package.json » eslint-config-react-app/jest#overrides[0]:
Environment key "jest/globals" is unknown
I'm convinced this is because desktop.ini files get created, and somehow they mess up the loading process of the dependencies. The problem gets fixed if I delete the whole node_modules folder and reinstall it using npm install. But the newly installed dependencies only last a couple of days (until the new desktop.ini files get regenerated) before they again break.
I've tried to stop windows from producing the desktop.ini files using the registry, but windows didn't listen (I run Windows 11). I've also seen that it is not recommended to delete/suppress these files.
Has anyone dealt with this issue? Are there any manageable workarounds?
Related
I am a dev on a team inside a very large project. This is the first time I have worked on a project where the node_modules/package-lock files are not in the root of the project. I am used to personal projects with a few folders, files, and the node_modules/package-lock in the root so I can always easily "npm install..." in the root.
I am running into an issue when I try to run npm install (package), it completely breaks my local project. I have to rollback the changes, rebuild, and it works fine again.
Things I have tried:
Navigate to the same directory that node modules is in.
Example: C:\Users\USERID\source\repos\companyName\companyName2\Web\Administration.
Node_modules and package-lock are located here along with ~20 other various folders.
Navigate to the root (even though node_modules isn't located here, figured I'd try).
Navigate to one folder above. I tried this because this is the directory where the Visual Studio .sln file is located.
Example: C:\Users\USERID\source\repos\companyName\companyName2\Web\companyName.Web.Administration.sln
For more context, the specific file I need to add a package to is: C:\Users\USERID\source\repos\companyName\companyName2\Web\Administration\ClientApp\app\letter\letter-create-main.component.ts
I am hoping I can get some clarity on how to properly run npm install in large projects so I can add packages that I need to this monster of a project, and hopefully help others that have this question at the same time!
I am trying to delete the node modules folder from my project so that I can rerun npm i as there were errors when I was running my npm scripts (I think node_modules corrupted), but I don't seem to be able to.
I've tried:
Deleting via right clicking in Windows explorer. This just doesn't do anything.
In VS Code right clicking and selecting 'Delete Node Modules', which produces the following message:
I think the node modules file has corrupted - there only seems to be 3 folders in there, all of which I can't delete.
If I run npm i I get the following:
Try to reboot windows with SAFE MOOD.
I face the same issue on windows 10. I could delete it when I have been in a safe mood on windows.
Don't know really an issue on windows or my hard drive.
I'm new to Firebase. Recently, in order to fix certain errors, I tried many different ways until I feel that my local project folder is pretty much messed up, which could cause more other hidden problems. For example, I keep running npm init on many different folders, sometimes manually edited the package.json file, run npm install firebase#5.9.4 --save on several different folders and so on.
So I wonder, is there a way (or tool) that we can scan through our project folder and safely clean it up, e.g. remove redundant/unused dependencies, e.g. node_modules, add required dependencies, fix declarations/referencing errors, and so on without removing user-created assets like .js, .css, images etc.? I want to do that is because I believe this could potentially reduce many hidden problems and help to narrow down my troubleshooting tasks...
Alternatively, can I do the following:
Backup all my JS files.
Empty my Firebase's functions folder.
run firebase init again.
Restore my JS files.
Deploy and troubleshoot my Firebase functions again? Or any steps missing?
Sorry for a silly question. Any advice would be much appreciated, thank you!
If you think there is a problem with the contents of your node_modules folder:
Remove all node_modules folders completely. They don't contain any special information. It is just copies of modules downloaded from the internet.
Rebuild it completely with npm install from the correct location (your functions folder), which uses your package.json to determine what it should contain.
I have a serverless nodejs project which was working just fine. Did not touch it for a week, wanted to re-deploy it and now I'm greeted with the following errors:
1) EPERM: operation not permitted, scandir ‘D:\GIT\awesome.build\node_modules’
2) EEXIST: file already exists, symlink ‘D:\GIT\awesome\node_modules’ -> ‘D:\GIT\awesome.build\node_modules’
First off I get the first error. If I try for a second time I get the second one. If I delete .build I'm back to receiving the first.
I know that during the idle week I did get the spring Windows update.
Windows 10 17134.48
NPM 6.1.0
Nodejs 8.11.1
Any ideas what could be causing this?
Updated Answer
We've identified and found the issue relating to this. We have published a new NPM module specifically with this fix and created a PR on the original plugin (but he hasn't updated it in ages)
Fixed Version
https://www.npmjs.com/package/#hewmen/serverless-plugin-typescript
Original Answer:
We're running into the exact same issue. Multiple serverless projects, multiple computers. We've tried different node versions as well. Completely wiping fetched repo and redoing it. We've tried using elevated consoles. No idea what's going on, but we're getting that exact same error on all our stuff across 3 different machines.
Current suspicion is Windows did an update recently that hosed it.. but I figured we'd see more info on it.
However, we did find a workaround for this.
Delete your current '.build' and '.serverless' folders inside the root project area
In command prompt, run 'sls package' and let it fail with the same error
Manually copy over 'node_modules' and 'package.json' from the root directory into the .build folder (delete the ones in there). This won't cause the error saying the .build directory already exists which you might have seen fighting this.
In command prompt, run 'sls deploy' (or 'sls package' if you only want to package)
Not ideal... but it got us deploying again until we figure out the real issue.
The issue seems to be in the way the symbolic link is created for node_modules inside the '.build' folder. It's linking a directory, but seems to be treating it as a file all of a sudden for whatever reason. In windows if you use "mklink" without the '/D' option on a directory, it will give you the same result we see in the '.build' folder. If you do the mklink /D - you don't have this issue.
This is why our current suspicion is a Windows update. Because everything was working perfectly fine, then all projects across all our Windows PCs stopped. We've rolled back our repos to stuff we've successfully deployed, and no issues. We've attempted to re-deploy projects we haven't touched in months, same issue.
It's very annoying to say the least. I will update this if we find out what's wrong.
Usually when I do 'npm install' inside my application directory, bunch of npm libraries files gets generated inside node_modules folder which is expected.
Today suddenly I started seeing many files getting generated inside application directory and outside node_modules.
Did anyone face this issue ? and if yes - any workaround ? Screenshot attached. Lot's of .cmd file, don't know why they are here.
Edit your c:\Users{username}.npmrc and remove the prefix.
I had the same issue, and was able to resolve this by completely uninstalling + re-installing Node/npm:
How to completely remove node.js from Windows