Tsc error when running 'npm build run'

I’d a local copy of n8n using npm. Based on an article about IIS deployment, I’d executed “npm build run” as per the guide but encountered the following error:

The following recorded in the log file.

9 verbose lifecycle [email protected]~build: CWD: C:\Program Files\nodejs\node_modules\n8n
10 silly lifecycle [email protected]~build: Args: [ ‘/d /s /c’, ‘tsc’ ]
11 silly lifecycle [email protected]~build: Returned: code: 1 signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: tsc
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Program Files\nodejs\node_modules\n8n
16 verbose Windows_NT 10.0.14393
17 verbose argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “run” “build”
18 verbose node v12.18.1
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: tsc
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

and seems related to package.json below:

“scripts”: {
“build”: “tsc”,
“dev”: “concurrently -k -n “TypeScript,Node” -c “yellow.bold,cyan.bold” “npm run watch” “nodemon””,
“postpack”: “rm -f oclif.manifest.json”,
“prepack”: “echo “Building project…” && rm -rf dist && tsc -b && oclif-dev manifest”,
“start”: “run-script-os”,
“start:default”: “cd bin && ./n8n”,
“start:windows”: “cd bin && n8n”,
“test”: “jest”,
“tslint”: “tslint -p tsconfig.json -c tslint.json”,
“typeorm”: “ts-node ./node_modules/typeorm/cli.js”,
“watch”: “tsc --watch”
},
“types”: “dist/src/index.d.ts”,
“version”: “0.78.0”

I’ve typescript 3.9.7. Any idea? Thanks.

hm does honestly not look like TypeScript is installed properly neither globally nor as part of n8n else it should not display the error that “tsc” is not known. So I would look into that again.

Here is a guide about how to set up n8n locally for development:

If you do not want to develop for n8n and rather just want to run it, TypeScript should not be needed at all. In this case a npm install n8n -g should be enough.

1 Like