I’m trying to create a node by using this link. but i have an error error TS18003.
I tried so many times. can you please help me how to fix it. Thanks!
Very sorry to hear that you have problems!
Is there a node to build in the folders in mentions? Does it end with “.node.ts”?
It is quite possible that the problem is windows related. I am “sadly” not a windows users so can be not much help here myself right now. Anybody else out there which uses windows and tried to build a node with “n8n-node-dev”?
yea.
node.ts file is in that folder
and then
After execute n8n-node-dev build
this command i got this The nodes got build and saved into the following folder:
C:\Users\sathi.n8n\custom but the folder is not created.
Hi All,
Is their any update on this, Because iam facing the same issues. I want to develop a Kafka Topic consumer Trigger but not able to get a head start into this. Please help
Regards
Srikanth.J
I’m also facing the same problem.
I think, this problem is probably caused by --rootDir
option of tsc
does not effects as intended.
FYI, tsc
command options are defined in <node_modules>n8n-node-dev\dist\src\Build.js
shown below.
<node_modules>n8n-node-dev\dist\src\Build.js
let buildCommand = `${tscPath} --p ${tsconfigData.path} --outDir ${outputDirectory} --rootDir ${process.cwd()} --baseUrl ${nodeModulesPath}`;
And these options are specified like below.
-
--p
:<User Directory>\AppData\Local\Temp\tmp-xxxxxxxxxxxxxxxxx
(temporally project file) -
--outDir
:<User Directory>\.n8n\custom
-
--rootDir
:<Current Directory>
-
--baseDir
:<node_modules Directory>
As far as I tried, it seems that tsc
searches input files only from the directory in where “temporally project file” exists and ignore the directory specified by --rootDir
option.
I found this problem can be tentatibely fixed by specifying the “temporally project file” location shown below. @sathishvp2495
n8n-node-dev\dist\src\Build.js
// const { fd, path, cleanup } = await tmp_promise_1.file(); // current
const { fd, path, cleanup } = await tmp_promise_1.file( { dir: process.cwd() } ); // modified
After this modification, you can build nodes/credentials properly.
So I propose that Build.ts should be modified like shown below. @jan
// Write new custom tsconfig file
// const { fd, path, cleanup } = await file(); // current
const { fd, path, cleanup } = await file( { dir: process.cwd() } ); // modified
@stm32p103 Welcome to the community and thanks a lot for looking into it!
The problem I had with this issue was that I was unable to debug it as it worked fine for me. So really appreciated that you had a closer look. I made the change you did propose. It did not make a difference for me and still works. So if that fixes the issue for you and some other people no reason not to add it.
Did just release a new version [email protected]
. I hope that fixes now the issue for you and everybody. Thanks again!
@jan Thank you for the quick response!
I’ve confirmed “error TS18003” does not occur after updated to 0.6.0.
(btw, I’m using Windows 10 Professional 64bit, Node.js 12.8.0, Typescript 3.6.2)
Great to hear! Thanks a lot for finding the solution!
Hey there,
we currently face this issue. Developing on Windows.
It looks like this change was reverted in Correct build command call to tmp-promise to create a temporarily file by omab · Pull Request #2185 · n8n-io/n8n · GitHub
Though re-applying this change does create the error mentioned in the PR as well.
Custom Node DEV Development using the CLI seems currently broken (again) on Windows.
We try to figure out how to solve this (once more).
For reference, this is a working “hack” which requires a custom “tsconfig-build.json” within your own n8n-nodes-custom-nodes project:
async function buildFiles(options) {
options = options || {};
let typescriptPath;
const tsconfigData = await createCustomTsconfig();
if (process.platform === 'win32') {
typescriptPath = '../../node_modules/TypeScript/lib/tsc';
tsconfigData.path = path_1.join(process.cwd(), 'tsconfig-build.json');
}
else {
typescriptPath = '../../node_modules/.bin/tsc';
}
The issue ist still the same as two years ago: tsc
resolves files in the directory where --p
points to. The --rootDir
as stated in the docs does NOT change the path for the include resolution.
Thus - on Windows - the tsconfig-build.json has to be called within the custom nodes project folder to make it work.