對nodejs不太熟悉酱畅,在ubuntu安裝了了nodejs琳袄,使用的方式是下載了可執(zhí)行包,然后在使用
npm install xxx
的時候報錯:
npm WARN deprecated grunt-rename@0.1.4: Deprecated
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated coffee-script@1.3.3: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated wrench@1.5.4: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.
npm WARN deprecated electron-packager@5.2.1: Critical security bug fixed in v7.0.0 - read more at https://github.com/electron-userland/electron-packager/issues/333
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated coffee-script@1.10.0: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated minimatch@0.2.12: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@2.0.4: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone -q git://github.com/kitematic/mixpanel-node.git /root/.npm/_cacache/tmp/git-clone-2e47ac17
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-2e47ac17': Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-12-10T15_30_51_431Z-debug.log
找尋了很多資料纺酸,發(fā)現(xiàn)是
npm permissions
問題窖逗,可以通過
npm config get prefix
找到npm的工作目錄,然后使用ls -l
查看該目錄的所有者所屬組是不是當前用戶餐蔬,如果不是肯定是安裝不來的碎紊,下面是可嘗試的方法。
解決方法:
1樊诺、官方提供了三種選擇:https://docs.npmjs.com/getting-started/fixing-npm-permissions
大家可以根據(jù)描述選擇合適自身環(huán)境的情況去嘗試仗考。
2、上面的方法還是不行的情況词爬,嘗試:
npm install -g npm@4
因為有可能是npm的版本問題秃嗜。
希望對你有所幫助。
Regards,
codjust