“npm config set registry https://registry.npmjs.org/” is not working in windows bat file

前端 未结 10 1495
自闭症患者
自闭症患者 2020-12-12 10:08

I create a.bat on windows 7, the content of a.bat is:

@echo off
npm config set registry https://registry.npmjs.org/

and then run a.bat, but

10条回答
  •  臣服心动
    2020-12-12 10:20

    1. Set npm registry globally

      use the below command to modify the .npmrc config file for the logged in user

      npm config set registry

      Example: npm config set registry https://registry.npmjs.org/


    1. Set npm registry Scope

      Scopes allow grouping of related packages together. Scoped packages will be installed in a sub-folder under node_modules folder.

      Example: node_modules/@my-org/packagaename

      To set the scope registry use: npm config set @my-org:registry http://example.reg-org.com

      To install packages using scope use: npm install @my-org/mypackage

      whenever you install any packages from scope @my-org npm will search in the registry setting linked to scope @my-org for the registry url.


    1. Set npm registry locally for a project

      To modify the npm registry only for the current project. create a file inside the root folder of the project as .npmrc

      Add the below contents in the file

       registry = 'https://registry.npmjs.org/'
    

提交回复
热议问题