mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat: Support community nodes on Windows (#3823)
* 🐛 Account for `APPDATA` in env * 🐛 Prevent starter installation * 🐛 Account for Win-style path delimiter * 👕 Fix lint
This commit is contained in:
parent
74cedd94a8
commit
e8eda7470a
|
@ -89,6 +89,7 @@ export const executeCommand = async (
|
|||
env: {
|
||||
NODE_PATH: process.env.NODE_PATH,
|
||||
PATH: process.env.PATH,
|
||||
APPDATA: process.env.APPDATA,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -64,7 +64,8 @@ class LoadNodesAndCredentialsClass {
|
|||
LoggerProxy.init(this.logger);
|
||||
|
||||
// Make sure the imported modules can resolve dependencies fine.
|
||||
process.env.NODE_PATH = module.paths.join(':');
|
||||
const delimiter = process.platform === 'win32' ? ';' : ':';
|
||||
process.env.NODE_PATH = module.paths.join(delimiter);
|
||||
// @ts-ignore
|
||||
module.constructor._initPaths();
|
||||
|
||||
|
|
|
@ -5,7 +5,11 @@ import { PublicInstalledPackage } from 'n8n-workflow';
|
|||
import config from '../../config';
|
||||
import { ResponseHelper, LoadNodesAndCredentials, Push, InternalHooksManager } from '..';
|
||||
|
||||
import { RESPONSE_ERROR_MESSAGES, UNKNOWN_FAILURE_REASON } from '../constants';
|
||||
import {
|
||||
RESPONSE_ERROR_MESSAGES,
|
||||
UNKNOWN_FAILURE_REASON,
|
||||
STARTER_TEMPLATE_NAME,
|
||||
} from '../constants';
|
||||
import {
|
||||
matchMissingPackages,
|
||||
matchPackagesWithUpdates,
|
||||
|
@ -80,6 +84,17 @@ nodesController.post(
|
|||
);
|
||||
}
|
||||
|
||||
if (parsed.packageName === STARTER_TEMPLATE_NAME) {
|
||||
throw new ResponseHelper.ResponseError(
|
||||
[
|
||||
`Package "${parsed.packageName}" is only a template`,
|
||||
'Please enter an actual package to install',
|
||||
].join('.'),
|
||||
undefined,
|
||||
400,
|
||||
);
|
||||
}
|
||||
|
||||
const isInstalled = await isPackageInstalled(parsed.packageName);
|
||||
const hasLoaded = hasPackageLoaded(name);
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ import { RESPONSE_ERROR_MESSAGES as CORE_RESPONSE_ERROR_MESSAGES } from 'n8n-cor
|
|||
|
||||
export const NODE_PACKAGE_PREFIX = 'n8n-nodes-';
|
||||
|
||||
export const STARTER_TEMPLATE_NAME = `${NODE_PACKAGE_PREFIX}starter`;
|
||||
|
||||
export const RESPONSE_ERROR_MESSAGES = {
|
||||
NO_CREDENTIAL: 'Credential not found',
|
||||
NO_ENCRYPTION_KEY: CORE_RESPONSE_ERROR_MESSAGES.NO_ENCRYPTION_KEY,
|
||||
|
|
Loading…
Reference in a new issue