Cannot install react-router-dom, please help


I have been able to install all packages from npm but when i try to add

npm install --save react-router-dom

i get below error, can any one please guide me as to what am i doing wrong …thanks

npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'D:\React\ReactData\node_modules\react-router\node_modules\path-to-regexp' -> 'D:\React\ReactData\node_modules\react-router\node_modules\.path-to-regexp.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

Any one please , i tried starting a new project, searched on net still no solution… same error, is there any thing wrong i installed, i use visual studio code

EDIT - it seems i cannot install any package now , same error, what wrong i might have done ?

It sounds like a race condition, and that you have multiple instances of Node running (multiple instances is normally fine, but sometimes it causes issues). Can you try closing Visual Studio and installing just on the command line, rather than inside VS? Also try opening Process Explorer, find any instances of Node, kill them all, then install via command line. Also try just running the install over and over again until it works (this latter is bit brute force but it normally ends up working)

@DanCouper - thanks , i resinstalled VS code and it seems to install the package …

1 Like