2016-01-03 72 views
0
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 

    > [email protected] 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! [email protected] postinstall: `bower install` 
    npm ERR! Exit status 1 
    npm ERR! 
    npm ERR! Failed at the [email protected] 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 

我的繼承人的package.json文件 可能是可能有一些愚蠢的錯誤,但實際上我不能夠擺脫this.may我知道我們爲什麼會實際上會得到這種錯誤嗎?任何幫助,將不勝感激NPM安裝顯示一些錯誤EACCESS

{ 
    "name": "angular-seed", 
    "private": true, 
    "version": "0.0.0", 
    "description": "A starter project for AngularJS", 
    "repository": "https://github.com/angular/angular-seed", 
    "license": "MIT", 
    "devDependencies": { 
    "bower": "^1.3.1", 
    "grunt": "^0.4.5", 
    "grunt-contrib-jshint": "^0.11.2", 
    "grunt-contrib-watch": "^0.6.1", 
    "http-server": "^0.6.1", 
    "jasmine-core": "^2.3.4", 
    "karma": "~0.12", 
    "karma-chrome-launcher": "^0.1.12", 
    "karma-firefox-launcher": "^0.1.6", 
    "karma-jasmine": "^0.3.5", 
    "karma-junit-reporter": "^0.2.2", 
    "protractor": "^2.1.0", 
    "shelljs": "^0.2.6" 
    }, 
    "scripts": { 
    "postinstall": "bower install", 
    "prestart": "npm install", 

    "start": "lr-http-server", 
    "pretest": "npm install", 
    "test": "karma start karma.conf.js", 
    "test-single-run": "karma start karma.conf.js --single-run", 
    "preupdate-webdriver": "npm install", 
    "update-webdriver": "webdriver-manager update", 
    "preprotractor": "npm run update-webdriver", 
    "protractor": "protractor e2e-tests/protractor.conf.js", 
    "update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@[email protected]@[\\s\\S]*\\/\\/@@[email protected]@/, '//@@[email protected]@\\n' + sed(/sourceMappingURL=angular-loader.min.js.map/,'sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map','app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@[email protected]@', 'app/index-async.html');\"" 
    } 
} 
+0

看來你真的必須改變這些文件的權限。 – AndreaM16

+0

可以解釋我該怎麼做,請! –

+0

您必須使用'chmod -R '。一看[這個問題](http://stackoverflow.com/questions/3740152/how-to-set-chmod-for-a-folder-and-all-of-its-subfolders-and-files-in -linux-ubunt)及其答案。 – AndreaM16

回答

0

你必須是根。嘗試:

sudo npm install 

,然後鍵入您的root密碼

+0

我以前只嘗試過,但即使那麼它不工作 –

+0

你可以給我們你的package.json在開放職位? – Tomislav

0

清潔您的NPM緩存:

npm cache clean

和運行以下命令,授予指定目錄的訪問

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

之後,你需要從頭開始重新安裝它,一切都將工作。