mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
fix(cli): load nodes and credentials on windows using the correct file-path (#4084)
This commit is contained in:
parent
3de0e228cb
commit
b6c1187922
|
@ -238,6 +238,9 @@ export function isNpmError(error: unknown): error is { code: number; stdout: str
|
|||
|
||||
const context = createContext({ require });
|
||||
export const loadClassInIsolation = (filePath: string, className: string) => {
|
||||
if (process.platform === 'win32') {
|
||||
filePath = filePath.replace(/\\/g, '/');
|
||||
}
|
||||
const script = new Script(`new (require('${filePath}').${className})()`);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return script.runInContext(context);
|
||||
|
|
Loading…
Reference in a new issue