• Nodejs修改全局仓库设置方案


    一、默认情况下nodejs内置的npm会把模块缓存在:“C:\Users\用户\AppData\Roaming\npm”
    打开cmd -> 输入命令 npm config ls ,查看系统默认的npm仓库目录。

    C:\Users\Daniel>npm config ls
    ; cli configs
    metrics-registry = "https://registry.npmjs.org/"
    scope = ""
    user-agent = "npm/6.14.10 node/v14.15.4 win32 x64"
    
    ; builtin config undefined
    prefix = "C:\\Users\\Daniel\\AppData\\Roaming\\npm"
    
    ; node bin location = D:\JavaFile\Nodejs\node.exe
    ; cwd = C:\Users\Daniel
    ; HOME = C:\Users\Daniel
    ; "npm config ls -l" to show all defaults.
    

    二、设置自定义全局仓库,新建model和cache。其中module对应prefix,cache对应cache。

    npm config set prefix "D:\JavaFile\Nodejs\model"
    npm config set cache "D:\JavaFile\Nodejs\cache" 
    

    三、查看配置是否生效

    C:\Users\Daniel>npm config ls
    ; cli configs
    metrics-registry = "https://registry.npmjs.org/"
    scope = ""
    user-agent = "npm/6.14.10 node/v14.15.4 win32 x64"
    
    ; userconfig C:\Users\Daniel\.npmrc
    cache = "D:\\JavaFile\\Nodejs\\cache"
    prefix = "D:\\JavaFile\\Nodejs\\model"
    
    ; builtin config undefined
    
    ; node bin location = D:\JavaFile\Nodejs\node.exe
    ; cwd = C:\Users\Daniel
    ; HOME = C:\Users\Daniel
    ; "npm config ls -l" to show all defaults.
    
  • 相关阅读:
    react-router-dom中的BrowserRouter和HashRouter,link与Navlink
    在React中使用react-router-dom路由
    详解react中的state,props,refs
    简单明了的vuex详解
    暂时性死区
    es6中的块级作用域
    es6的let
    前端模块化
    Web框架
    百分比布局 双飞翼布局 圣杯布局
  • 原文地址:https://www.cnblogs.com/InternetJava/p/15731273.html
Copyright © 2020-2023  润新知