npm install显示一些错误EACCESS

时间:2016-01-03 18:08:52

标签: node.js npm

struct

继承我的package.json文件 也许可能会有一些愚蠢的错误,但实际上我无法摆脱这种错误。可能我知道为什么我们会遇到这种错误呢?任何帮助将不胜感激

    i recently reinstalled ubuntu os and installed npm and nodejs, but when i run npm install i am issues with EACCESS which i am unable to understand, anyhelp ?
i was googling it about this issue but still could not fix it from hours, even i was going through many posts in stackoverflow but none solved my issue, can anyone please let me y is it happening ?

     npm install

    > angular-seed@0.0.0 postinstall /home/sri/oxkey
    > bower install

    /home/sri/oxkey/node_modules/bower/node_modules/configstore/index.js:56
                    throw err;
                    ^

    Error: EACCES: permission denied, open '/home/sri/.config/configstore/bower-github.yml'
    You don't have access to this file.

        at Error (native)
        at Object.fs.openSync (evalmachine.<anonymous>:549:18)
        at Object.fs.readFileSync (evalmachine.<anonymous>:397:15)
        at Object.create.all.get (/home/sri/oxkey/node_modules/bower/node_modules/configstore/index.js:34:29)
        at Object.Configstore (/home/sri/oxkey/node_modules/bower/node_modules/configstore/index.js:27:44)
        at readCachedConfig (/home/sri/oxkey/node_modules/bower/lib/config.js:19:23)
        at defaultConfig (/home/sri/oxkey/node_modules/bower/lib/config.js:11:12)
        at Object.<anonymous> (/home/sri/oxkey/node_modules/bower/lib/index.js:16:32)
        at Module._compile (module.js:435:26)
        at Object.Module._extensions..js (module.js:442:10)

    npm ERR! Linux 4.2.0-22-generic
    npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
    npm ERR! node v4.2.4
    npm ERR! npm  v2.14.12
    npm ERR! code ELIFECYCLE
    npm ERR! angular-seed@0.0.0 postinstall: `bower install`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the angular-seed@0.0.0 postinstall script 'bower install'.
    npm ERR! This is most likely a problem with the angular-seed package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     bower install
    npm ERR! You can get their info via:
    npm ERR!     npm owner ls angular-seed
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/sri/oxkey/npm-debug.log

3 个答案:

答案 0 :(得分:0)

你必须是root。尝试:

sudo npm install

然后键入您的root密码

答案 1 :(得分:0)

清理你的npm缓存:

npm cache clean

并运行以下命令以授予对指定目录的访问权限

sudo chown -R $(whoami) ~/.config

之后你需要从头开始重新安装它,一切都会有效。

答案 2 :(得分:0)

如果只是 sudo 仍然无法通过EACCESS失败,请尝试:

sudo npm c get user

这样做,我发现当 sudo -ed时, npm 使用的是我的原始用户ID(!)。使用临时配置覆盖user = 0在这种情况下,可能是最简单的解决方法。但是要当心不要将其用于本地安装!

npm 的这种行为在我进行了一些系统更新(使用Mac OS 10.13.6)后发生,但我无法确定它是何时发生的。