I'm a bit confused.
I accidentally installed yarn in a project. I just ran the command yarn that installed the yarn in the project. How do I uninstall yarn from the project?
Do I type in npm uninstall yarn? to uninstall it from a project?
I looked at other solutions and I'm confused.
Run npm uninstall yarn make sure it no longer is listed in your package.json
Delete the yarn.lock file if there is one
If in linux (similar for others I guess):
cd project_directory
Run "npm uninstall yarn"
rm -rf .yarn
rm .yarnrc.yml
rm yarn.lock
in package.json: delete "yarn" lines
in .gitignore (if present): delete "yarn" lines
in README.md (if present): change "yarn" to "npm"
run "grep -irl yarn ." to find any other references
Related
I am testing a JavaScript app that is hung up on an 'invalid ELF header'.
A wide open search finds multiple solutions.
Suggested solutions (in no particular order:)
add .dockerignore
add node_modules
install npm
rm -rf node_modules
add bcrypt("*") to package.json
npm install --global
npm
install -g node#6.17.1
use nvm to install node.js and npm
npm rebuild bcryptjs / bcrypt.js
npm rebuild bcrypt --build-from-source
rm -rf node_modules
Trying them at random has not helped. I am using a Jelastic platform to run a server.js app that was built in Eclipse on Windows 10. The app worked in localhost. So, I expected it to run in a Jelastic environment. But, I have exhausted vendor support for ERR_DLopen_FAILED.
When I run npm install, I'm getting the following error:
How can I solve this?
Update your node.js to the latest
make sure that the node version is up to date by running:
$ node -v
in your CMD and by visiting
https://nodejs.org/en/download/current/
To know what is the latest version.
run this command in your CMD:
$ npm cache clean --force
then Delete node_modules by running:
$ rmdir /S /Q node_modules
or delete it manually by going into the directory and right-click > delete / move to trash. If you are not updating your packages you can delete the package-lock.json file too.
now you can run:
$ npm install
This works for me, all the best.
So, I should delete all node_modules in my project(I want that the node_modules folder become completely empty). Just removing folder manually does not suit me.
I read that I can delete it with rm -rf node_modules/ BUT it does not work on WINDOWS.
How to delete it?
Deleting node_modules is as simple as writing the node_modules without a slash:
rm -rf node_modules
rm -rf node_modules shouldn't have a slash at the end /, and this worked for me even on Widows.
Installing globally rimraf will do the job.
npm install -g rimraf
From the docs:
If installed with npm install rimraf -g it can be used as a global
command rimraf [ ...] which is useful for cross platform
support.
So with installing this package, you can remove directories on all platforms(windows, linux).
All left to do is rimraf node_modules
A quick question about yarn and yarn.lock in a team setting. When someone updates yarn.lock in git, what is the procedure for developers?
Does yarn automatically figure out that the lock file is newer than node_modules and "figure it out", or do people remove their local node_modules and rerun yarn install?
Yarn won't do any check on node_modules folder when yarn.lock is updated via VCS.
To align node_modules folder with the dependencies listed in yarn.lock, there is no need to delete the folder. Run yarn command instead.
When I run yarn install (or just yarn for short) and I don't have a yarn.lock file yet, will the result depend on what packages are already installed in my node_modules directory? Or will node_modules end up in the same state regardless of what's already in there?
In other words, do I need to run rm -rf node_modules "just in case" before running yarn, to make sure that I get the latest versions?
yarn seems to wipe node_modules, generate a lockfile, then download everything without lockfile for me (0.18.1).
If I then modify node_modules, further yarn calls don't do anything, but adding a dependency introducing a change to the lockfile then calls it to wipe my node_modules again.
(I recall reading a yarn github thread about how wiping node_modules for any lockfile changes being the normal behavior, but now I don't know how to find that comment)