我在Windows 7上创建a.bat,a.bat的内容是:
@echo off
npm config set registry https://registry.npmjs.org/
Run Code Online (Sandbox Code Playgroud)
然后运行a.bat,但不工作,我发现单词"set"是npm和bat的特殊关键字,有什么方法可以解决这个问题吗?
我已经为 Github Action 编写了一个测试文件:
测试.yml
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
Run Code Online (Sandbox Code Playgroud)
但我的package.json使用组织私有存储库。当 Github Action 运行时,它失败并出现错误:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@org/repo/
npm ERR! 404
npm ERR! 404 '@org/repo@1.2.3' …
Run Code Online (Sandbox Code Playgroud)