earlier I have installed create-react-app globally, and I have used npx create-react-app appName
command for several times to create new react application. Everything was working fine, but all of sudden I am facing issue in creating new app using the same command.
Existing react apps are working fine, I can navigate to those directories and run npm start
, and application will start running/working smoothly, which concludes only create-react-app is not working properly.
NPM version : 6.14.11
Node version : v10.15.3
React script version (found in package.json of existing app):
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
I have gone through this stack-overflow question and tried few suggestions given in answers
I tried cleaing the cache: npm cache clean --force
I updated npm version npm install npm@latest -g
I have tried using these 3 ways :
npx create-react-app test100
creating directory test100 first, then from that directory
npx create-react-app .
As here its mentioned that if create-react-app is globally installed then no need to use npm/npx/yarn. So tried this one
create-react-app test100
But whatever I try, I get same error as follows, which says its having trouble copying some favicon file from CRA template, to public directory of application, then it terminates whole operation and deletes package.json file.
Please let me know how can I resolve this issue, as I am stuck in it from long time, any help will be appreciated.
Note: I'm working on windows machine, and have opened VScode in administrator mode.
Please go through following error, which I'm getting in VScode powershell console:
PS C:\Vikrant Local\react> npx create-react-app test100
Creating a new React app in C:\Vikrant Local\react\test100.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
> core-js@2.6.12 postinstall C:\Vikrant Local\react\test100\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js@3.8.3 postinstall C:\Vikrant Local\react\test100\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure@3.8.3 postinstall C:\Vikrant Local\react\test100\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
> ejs@2.7.4 postinstall C:\Vikrant Local\react\test100\node_modules\ejs
> node ./postinstall.js
+ cra-template@1.1.1
+ react@17.0.1
+ react-scripts@4.0.1
+ react-dom@17.0.1
added 1903 packages from 722 contributors and audited 1906 packages in 95.612s
126 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
fs.js:114
throw err;
^
Error: UNKNOWN: unknown error, copyfile 'C:\Vikrant Local\react\test100\node_modules\cra-template\template\public\favicon.ico'
-> 'C:\Vikrant Local\react\test100\public\favicon.ico'
at Object.copyFileSync (fs.js:1723:3)
at copyFile (C:\Vikrant Local\react\test100\node_modules\fs-extra\lib\copy-sync\copy-sync.js:67:6)
at onFile (C:\Vikrant Local\react\test100\node_modules\fs-extra\lib\copy-sync\copy-sync.js:53:25)
at getStats (C:\Vikrant Local\react\test100\node_modules\fs-extra\lib\copy-sync\copy-sync.js:48:44)
at startCopy (C:\Vikrant Local\react\test100\node_modules\fs-extra\lib\copy-sync\copy-sync.js:38:10)
at copyDirItem (C:\Vikrant Local\react\test100\node_modules\fs-extra\lib\copy-sync\copy-sync.js:122:10)
at fs.readdirSync.forEach.item (C:\Vikrant Local\react\test100\node_modules\fs-extra\lib\copy-sync\copy-sync.js:115:39)
at Array.forEach (<anonymous>)
at copyDir (C:\Vikrant Local\react\test100\node_modules\fs-extra\lib\copy-sync\copy-sync.js:115:23)
at mkDirAndCopy (C:\Vikrant Local\react\test100\node_modules\fs-extra\lib\copy-sync\copy-sync.js:110:3)
Aborting installation.
node has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Done.