Windows 10和Node版本16.13.1
我在我的package.json.When中有一个自定义脚本--我试着安装npm软件包,它给出了下面的错误;
URL=http://172.xxx.xx/repository/npm-registry 'URL‘不被识别为内部或外部命令、可操作的程序或批处理文件。npm错误!代码1
Package.json
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "node index.js",
"dev": "nodemon",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest --config=jest.json",
"test:watch": "jest --watch --config=jest.json",
"test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage",
"preinstall": "URL=http://172.xxx.xx./repository/npm-registry"
},发布于 2022-03-21 14:27:39
在set脚本之前添加preinstall。就像这样:
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "node index.js",
"dev": "nodemon",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest --config=jest.json",
"test:watch": "jest --watch --config=jest.json",
"test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage",
"preinstall": "set URL=http://172.xxx.xx./repository/npm-registry"
},https://stackoverflow.com/questions/71552910
复制相似问题