Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js npm create react应用程序错误:EACCES:权限被拒绝。操作系统拒绝了该操作_Node.js_Reactjs_Npm_Visual Studio Code_Terminal - Fatal编程技术网

Node.js npm create react应用程序错误:EACCES:权限被拒绝。操作系统拒绝了该操作

Node.js npm create react应用程序错误:EACCES:权限被拒绝。操作系统拒绝了该操作,node.js,reactjs,npm,visual-studio-code,terminal,Node.js,Reactjs,Npm,Visual Studio Code,Terminal,我想在vscode中使用react,但当我尝试安装node.js时,它会给我错误。我的命令是 npm install -g create-react-app 如何解决此问题请尝试以下命令: $sudo-s $npm安装-g创建反应应用程序 $exit $npx创建反应应用程序我的应用程序 只需从命令中删除-g。您不需要全局安装create react app。错误是因为您没有权限。请使用sudo npm install-g create react app这主要是因为您的用户无权全局安装npm

我想在vscode中使用react,但当我尝试安装node.js时,它会给我错误。我的命令是

npm install -g create-react-app
如何解决此问题

请尝试以下命令:

  • $sudo-s
  • $npm安装-g创建反应应用程序
  • $exit
  • $npx创建反应应用程序我的应用程序

  • 只需从命令中删除
    -g
    。您不需要全局安装
    create react app
    。错误是因为您没有权限。请使用sudo npm install-g create react app这主要是因为您的用户无权全局安装npm模块。我知道有两种修复方法。1.使用Sudo安装模块。像
    sudo npm安装-g create react app
    或2。您可以在没有root访问权限的情况下安装node js。从此处查找更多信息:。
    npm ERR! code EACCES
    npm ERR! syscall symlink
    npm ERR! path ../lib/node_modules/create-react-app/index.js
    npm ERR! dest /usr/local/bin/create-react-app
    npm ERR! errno -13
    npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/create-react-app/index.js' -> '/usr/local/bin/create-react-app'
    npm ERR!  [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/create-react-app/index.js' -> '/usr/local/bin/create-react-app'] {
    npm ERR!   cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/create-react-app/index.js' -> '/usr/local/bin/create-react-app'] {
    npm ERR!     errno: -13,
    npm ERR!     code: 'EACCES',
    npm ERR!     syscall: 'symlink',
    npm ERR!     path: '../lib/node_modules/create-react-app/index.js',
    npm ERR!     dest: '/usr/local/bin/create-react-app'
    npm ERR!   },
    npm ERR!   stack: "Error: EACCES: permission denied, symlink '../lib/node_modules/create-react-app/index.js' -> '/usr/local/bin/create-react-app'",
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'symlink',
    npm ERR!   path: '../lib/node_modules/create-react-app/index.js',
    npm ERR!   dest: '/usr/local/bin/create-react-app'
    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!     /Users/defneyazicioglu/.npm/_logs/2020-03-23T17_10_48_130Z-debug.log