〜/.npm目录是什么? [英] what is ~/.npm dir for?

查看:176
本文介绍了〜/.npm目录是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了全局npm软件包jslint,它位于此处

I have installed the global npm package jslint and it lives here

$ ls -la /usr/local/bin/jslint
lrwxr-xr-x  1 lust  admin  40 Feb 12 15:31 /usr/local/bin/jslint -> ../lib/node_modules/jslint/bin/jslint.js

$ ls -la /usr/local/lib/node_modules/jslint/bin 
total 8
drwxr-xr-x   3 lust  staff   102 Apr 16  2012 .
drwxr-xr-x  10 lust  staff   340 Feb 12 15:31 ..
-rwxr-xr-x   1 lust  staff  2330 Apr 16  2012 jslint.js

$ which jslint
/usr/local/bin/jslint

$ head -3 /usr/local/bin/jslint 
#!/usr/bin/env node

var linter = require("../lib/linter");

因此,毫无疑问,jslint实际上是从此目录运行的,而不是从这里运行的:

So it is without any doubt whatsoever at this point that jslint is in fact being run from this dir and not here:

$ ls -la .npm/jslint/0.1.9/package/bin/         
total 8
drwxr-xr-x  3 lust  staff   102 Apr 16  2012 .
drwxr-xr-x  9 lust  staff   306 Feb 12 15:31 ..
-rwxr-xr-x  1 lust  staff  2330 Apr 16  2012 jslint.js

该软件包似乎有两份副本,一份在/usr/local/中,一份在~/.npm中.为什么.npm中有一个,我可以安全地删除它吗?

There appear to be two copies of the package, one in /usr/local/ and one in ~/.npm. Why is there one in .npm and is it safe for me to remove it?

推荐答案

~/.npm是npm用来避免多次重新下载相同软件包的缓存.删除它没有害处.您可以使用以下命令将其清空:

~/.npm is a cache that npm uses to avoid re-downloading the same package multiple times. There's no harm in removing it. You can empty it with the command:

npm cache clean

这篇关于〜/.npm目录是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆