我正在尝试使用此命令安装 React 应用程序

I'm trying to installing react app using this command

npm install -g create-react-app

然后我得到这样的错误:

npm ERR! code EPERM

npm ERR! syscall mkdir

npm ERR! path C:\Windows\system32\node_modules

npm ERR! errno -4048

npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\node_modules'

npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'C:\Windows\system32\node_modules'] {

npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'C:\Windows\system32\node_modules'] {

npm ERR! errno: -4048,

npm ERR! code: 'EPERM',

npm ERR! syscall: 'mkdir',

npm ERR! path: 'C:\Windows\system32\node_modules'

npm ERR! },

npm ERR! errno: -4048,

npm ERR! code: 'EPERM',

npm ERR! syscall: 'mkdir',

npm ERR! path: 'C:\Windows\system32\node_modules',

npm ERR! parent: 'create-react-app'

npm ERR! }

npm ERR!

npm ERR! The operation was rejected by your operating system.

npm ERR! It's possible that the file was already in use (by a text editor or antivirus),

npm ERR! or that you lack permissions to access it.

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! C:\Users\Lagnajeet Jena\AppData\Roaming\npm-cache\_logs21-08-30T06_59_34_073Z-debug.log

你的 npm install 是系统范围的,这意味着你必须 运行 你的 cmd/terminal as admin/root 才能在 npm install 上使用 -g 标志.您也可以将 node.js/npm 重新安装到您的用户目录中。