create-react-app my-app
用管理员运行cmd,问题依然。
打开日志,看到错误详细信息如下
32189 verbose unlock done using C:\Users\feng\AppData\Roaming\npm-cache\_locks\staging-6ca308cbe79bff06.lock for D:\react\my-app\node_modules\.staging
32190 verbose stack Error: EPERM: operation not permitted, unlink 'D:\react\my-app\node_modules\nan\package.json'
32191 verbose cwd D:\react\my-app
32192 verbose Windows_NT 10.0.14393
32193 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\feng\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts"
32194 verbose node v8.2.1
32195 verbose npm v5.4.1
32196 error path D:\react\my-app\node_modules\nan\package.json
32197 error code EPERM
32198 error errno -4048
32199 error syscall unlink
32200 error Error: EPERM: operation not permitted, unlink 'D:\react\my-app\node_modules\nan\package.json'
32200 error { Error: EPERM: operation not permitted, unlink 'D:\react\my-app\node_modules\nan\package.json'
32200 error stack: 'Error: EPERM: operation not permitted, unlink \'D:\\react\\my-app\\node_modules\\nan\\package.json\'',
32200 error errno: -4048,
32200 error code: 'EPERM',
32200 error syscall: 'unlink',
32200 error path: 'D:\\react\\my-app\\node_modules\\nan\\package.json' }
32201 error Please try running this command again as root/Administrator.
32202 verbose exit [ -4048, true ]
网上找到一个答案 https://stackoverflow.com/questions/46103232/creat-react-app-is-not-installing-in-windows-10
让关闭 Windows Defender,我关闭了再试,还是不行。
又找到一个答案 http://blog.csdn.net/greatbody/article/details/61616555
让单独执行命令:
npm install -g react
npm install -g react-dom
npm install -g react-scripts
然后再创建项目,可是第三个命令我执行失败!
how?