centos下spm-yuan安装报错

centos下spm-yuan安装报错

未知原因在centos下安装spm-yuan的时候一直无法成功,报错信息如下:

Shell

EACCES, permission denied ‘/root/.spm’  you need install spm to register the program    $ npm install spm -g  if you have installed spm, it maybe you haven’t set a NODE_PATH environment variable

搜了一圈,基本上是说

if you have installed spm, it maybe you haven’t set a NODE_PATH environment variable

我想环境变量应该没有问题,其他node模块都正常运行着

Shell

[root@localhost ~]# echo $NODE_PATH/usr/local/lib/node_modules

一直没有找到合适的从问题本质上解决的方案,根据Github上网友phpgcs提供的方案解决(https://github.com/spmjs/spm-build/issues/18)

Shell

[root@localhost ~]# chmod 775 /root/.spm -R[root@localhost ~]# npm install spm-yuan -g

安装顺利没有报错,不过跑spm yuan服务的时候提示:

[root@localhost ~]# spm yuanPrepare repository…fs.js:654  return binding.readdir(pathModule._makeLong(path));                 ^Error: ENOENT, no such file or directory ‘/root/.spm/cache’    at Object.fs.readdirSync (fs.js:654:18)    at Object.prepareSpmCacheDir (/usr/local/lib/node_modules/spm-yuan/lib/base/util.js:21:18)    at module.exports (/usr/local/lib/node_modules/spm-yuan/index.js:18:14)    at Object.<anonymous> (/usr/local/lib/node_modules/spm-yuan/bin/spm-yuan:43:5)    at Module._compile (module.js:456:26)    at Object.Module._extensions..js (module.js:474:10)    at Module.load (module.js:356:32)    at Function.Module._load (module.js:312:12)    at Function.Module.runMain (module.js:497:10)    at startup (node.js:119:16)

Shell

直接切换到.spm下建一个cache目录即可

Shell

[root@localhost ~]# cd .spm[root@localhost .spm]# mkdir cache[root@localhost ~]# spm yuanPrepare repository…Start spm-yuan on port 3000

搞定。

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *