'How to fix error in "Copying template" when making project?
I'm generating a new project using React-Native in Command Prompt but I get an error when I use the following command:
react-native init Style
This is the result I get:
√ Downloading template × Copying template error Error: Cannot find module 'C:\Users\User\AppData\Local\Temp\rncli-init-template-srEvW0\node_modules\react-native\template.config' error EBUSY: resource busy or locked, rmdir 'D:\FUSI\React Native\Style'. Run CLI with --verbose flag for more details. Error: EBUSY: resource busy or locked, rmdir 'D:\FUSI\React Native\Style' at Object.rmdirSync (fs.js:684:3) at rmdirSync (D:\FUSI\React Native\node_modules\fs-extra\lib\remove\rimraf.js:276:13) at Object.rimrafSync [as removeSync] (D:\FUSI\React Native\node_modules\fs-extra\lib\remove\rimraf.js:252:7) at Object.initialize [as func] (D:\FUSI\React Native\node_modules\react-native\node_modules@react-native-community\cli\build\commands\init\init.js:295:26) at process._tickCallback (internal/process/next_tick.js:68:7)
How can I fix this error?
Solution 1:[1]
This Same error comes with me. But I solved by following ways...
First, uninstall the node from your system and download the latest version of node and install it.
2.after installation of the latest version of node you need to write the command in your command prompt
npm install -g react-native-cli
Now go to your project directory
cd your-react-native-project directory
now create your react-native project
react-native init your-project-name.
Solution 2:[2]
https://stackoverflow.com/a/71725307/16114216
Be sure uninstall global react-native/cli as described react-native tutorials
Try to use --npm end of init command if you had yarn and npm both.
npx react-native init MyApp --template react-native-template-typescript --npm
Note: If you have both yarn and npm installed on your machine, React Native CLI will always try to use yarn, so even if you use npx utility, only react-native executable will be installed using npm and the rest of the work will be delegated to yarn. You can force usage of npm adding --npm flag to the command.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abhishek Ahirwar |
| Solution 2 | Mustafa Ak |
