create-react-app权限问题与node_modules在应用程序内部



我运行:

npx create-react-app my-app

,并得到以下响应:

Creating a new React app in /home/austin/executable-bash/test_dir/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

added 1379 packages in 35s
186 packages are looking for funding
run `npm fund` for details
Initialized a git repository.
Installing template dependencies using npm...
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
added 39 packages in 4s
186 packages are looking for funding
run `npm fund` for details
Removing template package using npm...
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /home/austin/executable-bash/test_dir/my-app/node_modules/cra-template
npm ERR! dest /home/austin/executable-bash/test_dir/my-app/node_modules/.cra-template-AJu7jvgH
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/home/austin/executable-bash/test_dir/my-app/node_modules/cra-template' -> '/home/austin/executable-bash/test_dir/my-app/node_modules/.cra-template-AJu7jvgH'
npm ERR!  [Error: EACCES: permission denied, rename '/home/austin/executable-bash/test_dir/my-app/node_modules/cra-template' -> '/home/austin/executable-bash/test_dir/my-app/node_modules/.cra-template-AJu7jvgH'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/home/austin/executable-bash/test_dir/my-app/node_modules/cra-template',
npm ERR!   dest: '/home/austin/executable-bash/test_dir/my-app/node_modules/.cra-template-AJu7jvgH'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/austin/.npm/_logs/2022-06-02T18_59_15_191Z-debug-0.log
`npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^13.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0` failed
权限问题似乎与node_modulesINSIDE有关它刚刚创建的应用程序。奇怪的是吧?我有一个简单的工作来改变项目内部的权限:
cd my-app

改变权限:

chown -R $USER node_modules

和安装包:

npm i

这个可以工作,但是很明显,如果有npx create-react-app就更好了实际上是正常工作的。什么好主意吗?

我注意到,当我关闭vscode时,我能够让事情自己工作。所以我怀疑有vscode打开干扰的权限,但我不确定什么/为什么/如何。

相关内容

最新更新