对nodejs不太熟悉,在ubuntu安装了了nodejs,使用的方式是下载了可执行包,然后在使用
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
找寻了很多资料,发现是
npm permissions
问题,可以通过
npm config get prefix
找到npm的工作目录,然后使用ls -l
查看该目录的所有者所属组是不是当前用户,如果不是肯定是安装不来的,下面是可尝试的方法。
解决方法:
1、官方提供了三种选择:https://docs.npmjs.com/getting-started/fixing-npm-permissions
大家可以根据描述选择合适自身环境的情况去尝试。
2、上面的方法还是不行的情况,尝试:
npm install -g npm@4
因为有可能是npm的版本问题。
希望对你有所帮助。
Regards,
codjust
网友评论