代码之家  ›  专栏  ›  技术社区  ›  Marcius Leandro

创建REACT项目时出现权限错误

  •  0
  • Marcius Leandro  · 技术社区  · 3 年前

    我试着发出命令 npx create-react-app crud-book-management 但它给出了以下错误:

    npm ERR! code EPERM
    npm ERR! syscall symlink
    npm ERR! path ../@babel/parser/bin/babel-parser.js
    npm ERR! dest /media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/crud-boo-management/node_modules/.bin/parser
    npm ERR! errno -1
    npm ERR! Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/crud-boo-management/node_modules/.bin/parser'
    npm ERR!  [Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/crud-boo-management/node_modules/.bin/parser'] {
    npm ERR!   errno: -1,
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'symlink',
    npm ERR!   path: '../@babel/parser/bin/babel-parser.js',
    npm ERR!   dest: '/media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/crud-boo-management/node_modules/.bin/parser'
    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/marcius/.npm/_logs/2022-08-31T15_45_59_824Z-debug-0.log
    

    如果我试着用 sudo 它说没有找到npm命令,我认为运行create sudo

    我总是对npm感到困惑,有人知道我做错了什么吗?我该如何解决?

    更新

    我试试这个:

    sudo npm install -g create-react-app
    

    这是我的退场:

    npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
    
    added 67 packages, and audited 68 packages in 2s
    
    4 packages are looking for funding
      run `npm fund` for details
    
    2 high severity vulnerabilities
    
    Some issues need review, and may require choosing
    a different dependency.
    
    Run `npm audit` for details.
    

    但是,在运行命令时 npx创建react应用程序crud图书管理 我也犯了同样的错误,我试图添加 --no-bin-links ,并给出以下错误:

    Creating a new React app in /media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/crud-book-management.
    
    
    Installing packages. This might take a couple of minutes.
    Installing react, react-dom, and react-scripts...
    
    
    
    Aborting installation.
      npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts@0.9.x has failed.
    
    Deleting generated file... package.json
    Deleting crud-book-management/ from /media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management
    Done.
    

    我试着跑步 sudo npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts@0.9.x has failed. 以及:

    npm ERR! code EPERM
    npm ERR! syscall symlink
    npm ERR! path ../acorn/bin/acorn
    npm ERR! dest /media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/node_modules/.bin/acorn
    npm ERR! errno -1
    npm ERR! Error: EPERM: operation not permitted, symlink '../acorn/bin/acorn' -> '/media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/node_modules/.bin/acorn'
    npm ERR!  [Error: EPERM: operation not permitted, symlink '../acorn/bin/acorn' -> '/media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/node_modules/.bin/acorn'] {
    npm ERR!   errno: -1,
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'symlink',
    npm ERR!   path: '../acorn/bin/acorn',
    npm ERR!   dest: '/media/marcius/GERAL/SENAC/PSEL/Aula 00 - CRUD em React/crud-book-management/node_modules/.bin/acorn'
    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!     /root/.npm/_logs/2022-08-31T16_49_12_715Z-debug-0.log
    
    0 回复  |  直到 3 年前