I have a Yarn container which needs to mount something to the local filesystem when it runs. Is there a way to clean this up (do the unmount operation) when the container is cleaned up by Yarn?
Related
I have been running into Out Of Memory errors with typescript-eslint in a monorepo with ~20 TypeScript projects. This is a known issue and one of the mitigations is to enable single run detection with the parserOptions.allowAutomaticSingleRunInference = true option. This doesn't appear to ever trigger in a yarn managed repository though. Looking at the source, will this ever work? It seems like because yarn runs in a /tmp directory it will never match the file path to detect single run mode:
$ yarn exec which eslint
/tmp/xfs-3826b2c0/eslint
Let's say you're running this command:
npx gulp
npx will search for gulp within node_modules/.bin, and if it doesn't find it there, it will use a central cache. If it is missing, npx will install it.
How do I clear the central cache to force npx to reinstall gulp in this case?
On macOS (and likely Linux) it's ~/.npm/_npx, you can drop it with:
rm -rf ~/.npm/_npx
On Windows it should be %LocalAppData%/npm-cache/_npx
Either way, you can find npm’s cache by running npm config get cache and then finding an npx folder in there.
I needed to do this, due to an error in create-react-app saying 'We no longer support global installation of Create React App.' despite there being no global install. It was stuck in the npx cache, and I removed it like this
npx clear-npx-cache
using /src/setupProxy.js, I have import /server/index.js and start up a server api.
The trouble is that changes to files in /server/ directory do not restart the create-react-app so I don't see any of my changes until I kill it and restart it.
Is there a way to have create-react-app also watch the server directory for changes, or a way to use nodemon to run create-react-app?
it looks like you can do
nodemon create-react-app start
create-react-app does a better in place update in your browser when you make changes in the src directory, so you don't want nodemon triggering a restart in that case.
To avoid this, create a file called nodemon.json:
{
"ignore": ["src/*", "build/*"]
}
And then nodemon will only restart for non-react stuff updating.
I added the build directory too as it shouldn't be part of the restart.
I need to install apollo-engine for my cloud instance. This repository has dependencies:
"optionalDependencies": {
"apollo-engine-binary-darwin": "0.2018.4-86-gf35bdc892",
"apollo-engine-binary-linux": "0.2018.4-86-gf35bdc892",
"apollo-engine-binary-windows": "0.2018.4-86-gf35bdc892"
}
Those dependencies are super slow to install on my instance. Is there some way to redirect those repos to a disk location, or track them in my version control and do something like yarn install --<option to exclude apollo-engine-binary-*>
If using Docker or any other containerization system, you should be able to use a custom image providing yarn with those packages preloaded as cache.
I've got an irritating little bug with AWS, where I create my workspace (in this case, npm install) and distribute it to a bunch of slaves. Part of the install lifecycle for npm creates a bunch of symlinks in ./node_modules/.bin. Unfortunately, S3 doesn't support symlinks (see this question).
Now, it's a bit unfortunate that I'm downloading a prebuilt ./node_modules from S3, but it's how it's gotta be done (outside the scope of the question). When I run npm install on the slave, node doesn't recreate the symlinks.
I could always add a pretest hook to recreate the symlinks manually, but that's what got me wondering: is there a way to invoke specific parts of the npm lifecycle manually? If not, why? Running only parts of the install could be useful -- at least, here.