How to delete gatsby-starter-portfolio-cara file? - node.js

I have downloaded the gatsby-starter-portfolio-cara file from site and now I want to delete it. When I am trying to delete it, showed me an error that permission denied and cannot delete it. Error while deleting the file It also shows an lock icon. Can anyone tell me how to delete this file? I have nodejs 10.19 and npm 6.14.4

Open the terminal and run:
sudo rm -rf gatsby-starter-portfolio-cara
Keep in mind that you will need to stop the related background running processes, for example, if you are running gatsby develop.

Related

how can i install npm dependencies project?

I'm trying to deploy on my staging server but when i use the npm install command
i have the following problem:
and when I try to delete wit rm -rf node_modules/ i cant'n, i see the following message
rm: cannot remove 'node_modules/.html2canvas.DELETE/dist/types/css': Bad message
rm: cannot remove 'node_modules/.caniuse-lite.DELETE/data/features/audiotracks.js': Bad message
the proect use node version 10
can someone help me?
If you managed to delete the node_modules/ dir then it should be ok.
However, a bad message may indicate sth wrong logically with your filesystem, maybe related to a dirty shutdown, or physically with the disk.
I would recommend you, before you continue using this disk, to do a backup right now, and after you have the backup, a fsck, or if necessary, a disk health check.
Meanwhile, I would recommend you to do the job on another device.
And, right now, unmount the filesystem if possible, prevent any further write to it and other partitions on the same disk (in case it is disk-related), before you have the backup or the reason.
Remove the node_module folder with root access and try to run the installation with --force flag.

rm: cannot remove ‘test/deployment/sandbox-v2/tmp/dns’: Permission denied

I am unable to delete ‘test/deployment/sandbox-v2/tmp/dns’ after deleting the github repository 'test'. I am unable to reclone it in my CentOS system. Even after recloning in other folder,running site.yml file of sandbox fails at logs. So i'm trying to completely remove test repository and reclone it for fresh run. I have tried all ways and commands to remove it, it gets removed as well but then gets recreated automatically with this file mentioned. Any clue how to completely remove it and clone a fresh repo.
It's hard to say but if this was bind-mounted into a container and that container was running its process as root (uid 0) then files it created would be owned by uid 0 even outside the container. Gotta get your sudo on.
Is dns a symlink to something within /etc that the user has no right to modify/delete?
If you go into the "test/deployment/sandbox-v2/tmp/" and do "ls -l" what does it say?
If the file is a symlink, unlink it with "unlink dns" and now you should be able to delete the file structure from the "test" directory.

How to Delete node_modules - Deep Nested Folder in Windows

Upon trying to remove the node_modules directory created by npm install:
The source file name(s) are larger than is supported by the file
system. Try moving to a location which has a shorter path name, or try
renaming to shorter name(s) before attempting this operation
I also tried shift + delete and still having the same issue.
Since this the top google result, this is what worked for me:
Update, if you have npm v5, use npx:
npx rimraf ./**/node_modules
Otherwise install RimRaf:
npm install rimraf -g
And in the project folder delete the node_modules folder with:
rimraf node_modules
If you want to recursively delete:
rimraf .\**\node_modules
[ http://www.nikola-breznjak.com/blog/nodejs/how-to-delete-node_modules-folder-on-windows-machine/ ]
I've simply done that by using Winrar, this may seem a strange solution but working very well.
right click on node_modules folder
select Add to archive ... from the menu.
Winrar dialog opens
just check the option delete files after archiving
Don't forget to delete the node_modules.rar after finished.
[UPDATE]
This also works with 7Zip
DELETE only by using DOS command without any installation:
Create an empty folder "test" on C or D drive and use following DOS command
robocopy /MIR c:\test D:\UserData\FolderToDelete > NUL
After completing above command, your folder will be empty, now you can delete the folder.
Don't worry your test folder will always be empty, so you can delete it at any time.
I used GitBash to remove de folder!
rm -r node_modules
It took a while to delete everything, but worked for me!
You can use Git Bash to remove the folder:
example:
c:\users\olefrank\projects\mynodeproject
rm -rf /c/users/olefrank/projects/mynodeproject
Please save yourself the need to read most of these answers and just use npx rather than trying to install rimraf globally. You can run a single command and always have the most recent version with none of the issues seen here.
npx rimraf ./**/node_modules
Try Visual Studio Code
After trying many solution i find this one is pretty simple.
just open the project in Visual code and delete it. the UI may freeze for some seconds but it will definitely works.I test using many large size node_modules folder with it
Thanks
Delete Deep Netsted Folder like node_modules in Windows
Option 1
Delete using rimraf NPM package
Open command prompt and change your directory to the folder where
node_modules folder exists.
Run
rimraf node_modules
Missing rimraf ERROR then Install
npm install rimraf -g
When the installation completes, run
rimraf node_modules
Option 2:
Detele without installing anything
Create a folder with name test in any Drive
robocopy /MIR c:\test D:\UserData\FolderToDelete > NUL
delete the folder test and FolderToDelete as both are empty
Why this is an issue in windows?
One of the deep nested folder structure is node_modules, Windows can’t delete the folder as its name is too long. To solve this, Easy solution, install a node module RimRaf
I think this was not mentioned before. but the best way to delete unwanted node_modules is to install an utility called npmkill.
Installation:
From your terminal:
npm i -g npkill
And to use it:
From your terminal:
npkill
or alternatively, you can directly use it without installation by writing:
npx npkill
You will then be presented with a list of projects, and by hitting space bar you can delete their node_modules.
simple just run for windows I haven't tested it for other operating systems
rm -r node_modules
in fact, you can delete any folder with this.
like rm -r AnyFolderWhichIsNotDeletableFromShiftDeleteOrDelete.
just open the gitbash move to root of the folder and run this command
Hope this will help.
Thanks,
Ajay Kotnala
On Windows Platform the simplest way is to use the terminal.
Please Run the command RMDIR /Q/S foldername to delete the folder and all of its subfolders.
Example: RMDIR /Q/S node_modules
The Above Command deletes node_modules folder and its subfolders.
For information please visit this https://www.ghacks.net/2017/07/18/how-to-delete-large-folders-in-windows-super-fast/
You can use Git Bash to remove the folder:
example:
c:\users\stu\projects\mynodeproject
rm /c/users/stu/projects/mynodeproject -rfd
I had a similar problem and RD didn't work, for some unknown reason.
NPM can get rid of its own mess though, so if you do npm uninstall [module-name] for each directory in node_modules, you'll get rid of them.
(I'll look up how to batch loop this later, for those who have lots of dependencies.)
npm install -g remove-node-modules
cd to root and remove-node-modules
or remove-node-modules path/to/folder
Source:
https://github.com/j-quelly/node-cleanup
I just do del node_modules inside my project folder on PowerShell, it will ask you if you want to remove it and its children folder, just hit 'Y' and that's it
Just use powershell..
Run powershell and cd to the parent folder and then:
rm [yourfolder]
as in:
rm node_modules
Tried everything but didn't work. All the above methods did nothing. At last I was able to delete via VSCode.
Just Open your root folder with VSCode.
Select node_modules folder and delete.
Profit. (It will take few milliseconds to delete.)
On Windows, using Total Commander all you have to do is select the folder click shift + delete . Don't forget about the shift key.
Any file manager allow to avoid such issues, e.g Far Manager
I made a Windows context item to fast delete node_modules or other folders.
I use it when Windows doesn't delete a folder because of some invalid chars in the directory path.
HOW TO INSTALL?
Install rimraf => npm install rimraf -g
Create a new file named delete.bat, set the content as below and copy it into c:\windows\system32\
delete.bat:
#ECHO OFF
ECHO.
ECHO %CD%
ECHO.
ECHO Are you sure to delete the folder with Rimraf?
PAUSE
SET FOLDER=%CD%
CD /
rimraf "%FOLDER%"
rem DEL /F/Q/S "%FOLDER%" > NUL
rem RMDIR /Q/S "%FOLDER%"
EXIT
Run fast-delete.reg file to import into registry.
Done!
The PowerShell way:
PS > rm -r -force node_modules
# The same, but without using aliases
PS > Remove-Item -Recurse -Force node_modules
And if you want to delete every node_modules in sub directories:
Note Potentially dangerous as it deletes recursively, be sure of what you're doing here
PS > dir -Path . -Filter node_modules -recurse | foreach {echo $_.fullname; rm -r -Force $_.fullname}
I needed to clean up an entire Projects directory for backup purposes, so I installed rimraf and ran this at the root dir (inside a git bash prompt):
find . -name "node_modules" -type d -prune -exec rimraf '{}' +
Very effective, truly recursive (avoids children node_modules) and fast on windows (thanks to rimraf).
Sources:
https://rtmccormick.com/2018/01/10/clear-node-modules-folders-recursively-mac-linux/
The accepted answer in this question that suggests rimraf but lacks in the recursive aspect
One solution that I use:
(I would prefer to avoid installing a new extension (rimraf) when working with CI environments.)
A) Rename packages.json to something else. B) Specially on CI - after npm install, I usually remove the file instead of renaming it, but if you need it, you don't have to do this. That's your choice.
run npm init - this will create an empty packages.json file (no dependencies)
run npm prune - this will match node_modules with the dependencies section of packages.json - which is now empty as the result of step #2.
If you have chosen #1.A. step, delete the newly created packages.json, and rename original packages.json back to its original name.
Its too easy.
Just delete all folders inside node_modules and then delete actual node_module folder.
This Works for me. Best luck....
Sometimes, even if you install rimraf globally you can have a local rimraf dependency (SASS usually have it). In this case I would run following commands:
Follow first 2 steps as usagidon recommended, if you have issues or errors try
npm uninstall rimraf & rimraf node_modules
this will delete local rimraf and use the global one
On Windows my go to solution is using the rmdir command:
rd /S .\node_modules\
If it fails the first time -- try one more time.
Also check if you have running scripts currently using the modules (npm run serve or similar).
From this looks of this MSDN article, it looks like you can now bypass the MAX_PATH restriction in Windows 10 v1607 (AKA 'anniversary update') by changing a value in the registry - or via Group Policy
I'm on windows 10 and I could'nt delete folders with message "directory not emtpy". Neither rimraf nor rm -rf worked.
Copying an empty text file to every single folder did the trick - I was able to delete the complete node_modules folder.
Not exactly related, but as this is the first post I found in my search for a similar solution I think it's worth posting here.
I was running into permission issues on Windows 10 trying to delete my node_modules folder after a failed attempt at installing electron-redux. It seems electron-redux added #types to my node_modules, which had incorrect permissions set up.
rimraf did not work as it still ran into permission issues.
I ended up renaming node_modules then a simple delete worked.
Okay so my problem was that i had .bin folder inside node_modules and i wasn't able to delete that, I tried all the above solutions for the same but nothing worked.
Error which was repeating was "u do not have permission to delete the folder or its been used by some other program".
Solution that i found "I had Antivirus installed on my pc ,which was unknowingly using the files from node_modules folder".
I uninstalled the antivirus or u can change permission setting from antivirus setting option (depends on which antivirus u have).Now i am able to delete node_modules folder.

npm install give Error: EPERM, unlink

using command npm install give the following error
Error: EPERM, unlink
System info:
Bower version: 1.3.12
Node version: 0.10.35
OS : Windows8
I tried below workaround but nothing is worked out.
clean bower cache
uninstall bower
Update decompress-zip using npm
install the bower again
Its not worked for me please suggest me some solution
I got this problem, yes in Windows 10.
Solution?
To disable indexing of contents for that folder (the one containing the package.json)!!
On Windows Shell (File Manager), follow this steps:
Right click on the folder with the error, choose 'Properties'
Click the 'Advanced...' button.
Uncheck the checkbox 'Allow files in this folder to have contents indexed in addition to file properties'.
Press 'OK'.
On the previous Properties dialog (visible again), press 'Apply'
Check radio button 'Apply changes to this folder, subfolder and files'.
Press 'OK'.
(can take a while)
Press 'OK' (to close properties dialog).
Works!
In my case, it was permissions - probably in the node_modules tree, but just to be sure, I granted myself ownership and rights to the entire project tree which fixed the problem.
Right click on your project folder, select Properties, then the Security tab and click the Advanced button. Set yourself as the owner and grant yourself full permissions. Check "Replace all child object permission..." and OK.
My case was even simpler... a process was still using one of the files in the folder that required deletion. Killing the task responsible enabled me to install correctly.
You don't have the permissions necessary to remove that file. Somehow you have caused npm/bower to do things that conflict with the default windows permission system.
It would probably be simplest to remove bower and npm and reinstall them, and then update your npm to the latest version following the instructions here https://github.com/npm/npm/wiki/Troubleshooting
For a quick fix that might help, try this in a CMD window (you may need to start it as Administrator):
cd C:\users\path\temp
cacls . /T /E /C /G Everyone:F
That grants Everyone Full Control over your temp directory, which is potentially a security risk. However, it should make it possible for npm and bower to clean up old files.
I recommend you try reinstalling node, npm, and bower.
For me, remove the indexation has solved my problem.
But the indexation was back after to have recreate the folder. In this case the solution is one the options follow:
disable permanently the indexation service
or
exclude the folder of indexation
or
exclude the file format in indexation option.
I am on Windows 10 and this action seems resolve my problem permanently.
Had a similar issue - npm install had worked fine for months, but we upgraded a few libraries and started getting the same error.
Ended up switching from NPM to yarn, which did work.
I got the same error and it has been solved by using correct version of node for npm. Check your package.json 'engines' and your installed node version. You can use Node version manager if you need to have several versions installed and switch between them: https://github.com/coreybutler/nvm-windows/releases
What I tried
delete node_modules folder
delete package-lock.json
run npm clear cache --force
undo if the files in the folder are read-only
run npm i again worked

npm install failed because of virtual directory

I'm trying to setup a new project which is a git repo stored on a virtual drive (wuala).
Is it possible that this is not possible? Because when I try npm install I get the following error:
node.js:815
var cwd = process.cwd();
^
Error: ENOENT, no such file or directory
at Function.startup.resolveArgv0 (node.js:815:23)
at startup (node.js:58:13)
at node.js:906:3
Ok, so the issue was node not finding the current working directory. I didn't know it was only a virtual directory, after downloading the folder locally it works.
Now if only there is way to download the folder locally every time wuala is running & to be deleted afterwards...
Could the problem be that Wuala doesn't accept empty folders? This topic seems to suggest non-standard behavior when it comes to empty folders:
https://support.wuala.com/forums/topic/wuala-does-not-accept-an-empty-folder-on-my-lacie-2big-as-sync-partner/
I came across this issue today and I don't think its related to the file system being virtual or not. The answer is really simple and weird.
I followed these steps to reproduce the issue:
Open a Terminal and cd to a directory (let's say /home/user/dir)
Delete the directory from your file manager (nautilus in my case)
The console still shows :
user#user-PC:~/dir$
although the directory doesn't exist.
Run a node command. I ran sudo npm update -g cordova
You get the above error. So, the solution is as simple as being in a directory which exists and then executing the node command.

Resources