NervJS / taro-zhihu-sample

a demo based on taro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

安装依赖时失败 permission denied

tongjun741 opened this issue · comments

centos 7.4
node 8.11.3
root用户

npm i

gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/opt/taro_zhihu/node_modules/node-sass/.node-gyp' gyp ERR! System Linux 3.10.0-693.el7.x86_64 gyp ERR! command "/root/node-v8.11.3-linux-x64/bin/node" "/opt/taro_zhihu/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd /opt/taro_zhihu/node_modules/node-sass gyp ERR! node -v v8.11.3 gyp ERR! node-gyp -v v3.7.0 gyp ERR! not ok Build failed with error code: 1

使用yarn install或者taro update project没有问题

commented

查看一下系统的 /opt 目录权限。

当前是root用户,应该不会有权限的问题

[root@localhost opt]# ll 总用量 4 drwxr-xr-x. 8 root root 4096 7月 16 18:09 taro_zhihu [root@localhost opt]# ll taro_zhihu/ 总用量 292 drwxr-xr-x. 2 root root 4096 7月 16 18:08 config drwxr-xr-x. 2 root root 4096 7月 16 18:09 dist drwxr-xr-x. 871 root root 36864 7月 16 18:09 node_modules -rw-r--r--. 1 root root 1207 7月 16 18:08 package.json -rw-r--r--. 1 root root 3457 7月 16 18:08 README.md drwxr-xr-x. 5 root root 4096 7月 16 18:08 src -rw-r--r--. 1 root root 235317 7月 16 18:09 yarn.lock [root@localhost opt]# ll taro_zhihu/node_modules/ 总用量 3488 drwxr-xr-x. 2 root root 4096 7月 16 18:09 abbrev drwxr-xr-x. 2 root root 4096 7月 16 18:09 accepts drwxr-xr-x. 4 root root 4096 7月 16 18:09 acorn drwxr-xr-x. 5 root root 4096 7月 16 18:09 acorn-dynamic-import drwxr-xr-x. 3 root root 4096 7月 16 18:09 acorn-jsx

应该是在创建'/opt/taro_zhihu/node_modules/node-sass/.node-gyp'目录时上级目录'/opt/taro_zhihu/node_modules/node-sass'不存在:

[root@localhost taro_zhihu]# ls /opt/taro_zhihu/node_modules/node-sass ls: 无法访问/opt/taro_zhihu/node_modules/node-sass: 没有那个文件或目录