Search code examples
react-nativenpmstyled-components

Why does npm isntallation of styled-components for React Native fail?


I am trying to install styled components for a React Native project:

C:\Projects\Native1>npm install --save styled-components

The installation fails with following error:

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\Projects\Native1\node_modules\camelize
npm ERR! dest C:\Projects\Native1\node_modules\.camelize.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Projects\Native1\node_modules\camelize' -> 'C:\Projects\Native1\no
de_modules\.camelize.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

The directory really doesn't exist in the node_modules folder. What can I do install the module succesfully?


Solution

  • clean cache from your nodemodules folder

    npm cache clean --force

    Or

    delete your nodemodules folder

    then run

    npm i styled-components