-
-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rimraf in package.json error #102
Comments
It only does it on Windows not on Debian Linux |
I'm also noticing this issue. What can I do to help troubleshoot this? |
@AaronNGray So, let me see if I understand this correctly:
What may be occurring here is that Windows is getting upset with you trying to unlink a file that is currently in use, and thus locked. (Unix filesystems do not have this limitation.) |
@isaacs yes this is exactly the case here. Idk how to deal with it though. |
@Restuta @AaronNGray Can you change the script to do |
Temporary Workaround: One of the solutions would also be able to install rimraf as a global package, after running npm install by including the following line in your package.json.
|
… `.bin` within `node_modules` to prevent Windows from throwing an error. See isaacs/rimraf#102
I am working on Windows 10, the temporary solution "postinstall" provided by @etiennejcharles is not working in my case. |
@hegdeashwin I think that if your project has a(n) (in)direct dependency on Trying to run a script that deletes itself on Windows just isn’t a clean thing to do (unless you use whatever tricks Cygwin’s If you choose to use |
@hegdeashwin @binki The notion of being able to delete node modules itself, especially on windows, has come up many times in conversation (and I think more than a few times in this issue tracker). I believe the conclusion is been that the ability to do so is outside the scope of To workaround all of this, I created a separate standalone single file bundle of rimraf: https://www.npmjs.com/package/rimraf-standalone
Follow the link above for all the details. |
@kylecordes Thanks for that link, its exactly what I was looking for. Standalone rimraf that works to remove Update: For some reason the script fails with I have about 100 packages and it works fine to remove them all, as long as For a solution I just opted to install that package globally and it works fine now. |
I've encountered this issue as well. When I use the aforementioned script (#102 (comment)) in the package.json file: "scripts": {
"clean": "rimraf 'node_modules/!(rimraf|.bin)'"
} I'm seeing this error when the script is executed (Windows 10):
When I create a #!/usr/bin/env node
'use strict';
const fs = require('fs');
const rimraf = require('rimraf');
rimraf('node_modules/!(rimraf|.bin)', fs, () => {}); I believe that the vertical bar in the glob is being treated as a pipe. Anyone know of a way around this problem? |
@Mottie
|
If you are unable or unwilling to install rimraf globally, the best solution is to use the new |
@IAMtheIAM's suggestion to use |
Glob support dropped in v4. Just give it the arguments for the thing you want deleted. Note that shell expansion is VERY different on windows from how it is on the posix shell. |
I had this issue and running sudo before the command fixed it for me :) |
Hi, I am using rimraf as a 'npm run clean' command in package.json on Windows 10 it does delete the node_modules directory but I am getting the following error :-
with the package.json file :-
The text was updated successfully, but these errors were encountered: