Describe the bug
On Windows, the command n8n-node-dev build fails to find the TypeScript installed in the package's node_modules. Therefore, the command fails to transpile the files into ~/.n8n/custom.
To Reproduce
Steps to reproduce the behavior:
Install CLI tool globally: npm i n8n-node-dev -g
Create a new node directory: cd packages/nodes-base/nodes/ && mkdir MyNewNode && cd MyNewNode
Create a new node: n8n-node-dev new
Transpile the node: n8n-node-dev build
Inspect the ~/.n8n/custom/ directory. The TS files will not have been transpiled into JS. Note that the error message ends with a success message, but no JS files are created.
Expected behavior
The TS should have been transpiled into JS and placed in ~/.n8n/custom/.
Environment (please complete the following information):
OS: Windows 8.1
n8n Version: 0.69.0
Node.js Version: 12.18.0
Additional context
According this line, the CLI tool's build command looks for TypeScript in the path node_modules/.bin/tsc. That is an extensionless file containing a bash script. The build command tries to execute this file as JavaScript, causing SyntaxError: Missing ) after argument list. This issue directly relates to this commit.
On Windows, I solved this by changing the path to TypeScript to ../../node_modules/TypeScript/lib/tsc or ../../node_modules/TypeScript/bin/tsc. This should be tested in other operating systems to ensure the CLI tool build command still works with the new path to TypeScript.
I'm from the MLH Fellowship and I would be happy to turn it into a PR, if you think this is an appropriate solution.
Describe the bug On Windows, the command
n8n-node-dev build
fails to find the TypeScript installed in the package'snode_modules
. Therefore, the command fails to transpile the files into~/.n8n/custom
.To Reproduce Steps to reproduce the behavior:
npm i n8n-node-dev -g
cd packages/nodes-base/nodes/ && mkdir MyNewNode && cd MyNewNode
n8n-node-dev new
n8n-node-dev build
~/.n8n/custom/
directory. The TS files will not have been transpiled into JS. Note that the error message ends with a success message, but no JS files are created.Expected behavior The TS should have been transpiled into JS and placed in
~/.n8n/custom/
.Environment (please complete the following information):
Additional context According this line, the CLI tool's build command looks for TypeScript in the path
node_modules/.bin/tsc
. That is an extensionless file containing a bash script. The build command tries to execute this file as JavaScript, causingSyntaxError: Missing ) after argument list
. This issue directly relates to this commit.On Windows, I solved this by changing the path to TypeScript to
../../node_modules/TypeScript/lib/tsc
or../../node_modules/TypeScript/bin/tsc
. This should be tested in other operating systems to ensure the CLI tool build command still works with the new path to TypeScript.I'm from the MLH Fellowship and I would be happy to turn it into a PR, if you think this is an appropriate solution.