mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-11-29 18:58:26 +08:00
fix(pm): error retrieving .npmrc file path
This commit is contained in:
parent
229e5d1a40
commit
6781f28fbf
@ -70,11 +70,11 @@ export function getNodeModulesPluginDir(packageName: string) {
|
||||
export function getAuthorizationHeaders(registry?: string, authToken?: string) {
|
||||
const headers = {};
|
||||
if (registry && !authToken) {
|
||||
const npmrcPath = path.join(process.cwd(), '.npmrc');
|
||||
const npmrcPath = path.join(os.homedir(), '.npmrc');
|
||||
const url = new URL(registry);
|
||||
let envConfig: Record<string, string> = process.env;
|
||||
if (fs.existsSync(npmrcPath)) {
|
||||
const content = fs.readFileSync(path.join(process.cwd(), '.npmrc'), 'utf-8');
|
||||
const content = fs.readFileSync(npmrcPath, 'utf-8');
|
||||
envConfig = {
|
||||
...envConfig,
|
||||
...ini.parse(content),
|
||||
|
Loading…
Reference in New Issue
Block a user