惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

博客园 - DiryBoy

修复运行 tasklist 命令时提示 ERROR: Not found 删除坏掉的 Active Directory Domain 为 WSUS 服务器定期运行清理向导 为 Exchange 服务器编写自定义的反垃圾插件 在 Win10 命令行使用 Consolas + 微软雅黑 Setting up SSL for SCM-Manager with Microsoft CA and TortoiseHg Installing SCM-Manager Win 7 装 SQL Server 2008 后使用 Asp.Net 需要进行的一些配置 为 IE8 写一个转跳加速器 WPF 实现已绑定集合项目的移除时动画过渡 成功在 Win 7 下用 VirtualBox 装 Win 7,分享一些经验 如何写递归的 Lambda 表达式 使用动态生成的委托提高调用动态程序集的性能 在 Azure 中部署支持 MVC 的 Asp.Net 应用程序 DIY 自己的多点触摸系统 未来就在眼前 用 C# 实现的前缀树 - Trie 自己改造 VSPaste 插件 用C# 写的龙贝格(Romberg)积分法
Windows 10 下安装 npm 后全局 node_modules 和 npm-cache 文件夹的设置
DiryBoy · 2016-03-30 · via 博客园 - DiryBoy

npm 指 Node Package Manager,是 Node.js 中一个流行的包管理和分发工具。Node.js 在某个版本的 Windows 安装包开始已经加入了 npm,现在可以进入 https://nodejs.org/en/ 下载安装包。

安装过程很简单,一路 Next 然后 Finish 就好。安装完成后可以新建一个命令行窗口,敲 npm 验证安装。

我碰到的问题是,当我安装完一个全局的 webpack 工具后,发现很多新下载的文件分别存到了 %appdata% 下的 node_modules 和 npm-cache 这两个文件夹中,我不爽是因为 %appdata% 是 Roaming 的,这些东西其实并不需要 roam。

npm 的文档 https://docs.npmjs.com/files/folders 说了一堆,并没什么用,最后我在爆栈的这个回答的启发下找到了适合我的方法:

npm config set prefix ${userprofile}\.npm --global
npm config set cache ${userprofile}\.npm\cache --global

这样一来,会有一个 npmrc 文件生成在 %appdata%\npm\etc 文件夹中,内容就是上面的配置,这个配置文件 roam 是没问题的。

最后,还需要修改一下环境变量 PATH,把安装时默认添加的路径改成 prefix 里面定义的路径,这样命令行工具就能在新的地方找到 npm 了。