Skip to content

Commit

Permalink
fix(cli): load nodes and credentials on windows using the correct fil…
Browse files Browse the repository at this point in the history
…e-path (n8n-io#4084)
  • Loading branch information
netroy authored Sep 12, 2022
1 parent 6ab227d commit 5d3fb98
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/cli/src/CommunityNodes/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5d3fb98

Please sign in to comment.