n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
48.46k stars 7.58k forks source link

CLI tool build command fails to find Typescript on Windows #665

Closed ivov closed 4 years ago

ivov commented 4 years ago

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.

build-fail-screenshot

To Reproduce Steps to reproduce the behavior:

  1. Install CLI tool globally: npm i n8n-node-dev -g
  2. Create a new node directory: cd packages/nodes-base/nodes/ && mkdir MyNewNode && cd MyNewNode
  3. Create a new node: n8n-node-dev new
  4. Transpile the node: n8n-node-dev build
  5. 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):

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.

janober commented 4 years ago

Fix got released with n8n-node-dev@0.10.0