【发布时间】:2017-11-03 23:56:05
【问题描述】:
我正在尝试在我的本地机器 (centOS) 上做 react 教程
我跑了
sudo npm install -g create-react-app
运行该命令后出现以下错误
npm ERR! Linux 3.10.0-514.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "create-react-app"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! path /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall open
npm ERR! Error: EPERM: operation not permitted, open '/tmp/npm- 1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz' while getting shasum for /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, open '/tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz' while getting shasum for /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! at Error (native)
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: '/tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz',
npm ERR! parent: 'tar-pack' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
我尝试进入目录并解压缩 .tgz 文件并更改一些权限,但没有任何效果。我在网上遵循了一些类似问题的解决方案,但仍然没有运气。
我也跑了
npm cache clear
谁能解释为什么会这样?有什么建议吗?
【问题讨论】:
-
@TimeDead 是的,但它处理 EACCES 错误,这是一个 EPERM 错误。
-
嗯,您是否尝试过
chmod或检查您的/tmp文件夹的权限? -
是的,我有。使用
ls -l返回drwxrwxrwt. 24 root root 4096 Jun 6 07:42 tmp
标签: node.js linux reactjs npm npm-install