mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:29:16 +00: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