Writing a step in nodejs but it does not run the js file

Hi i am writing a step in nodejs. I tried this on my bitrise.yml but it doesn’t work.

- script@1.1.3:
- runner_bin: node
- content: “wetransfertupload.js ${WTU_FILEPATH}”

With the error :
(function (exports, require, module, __filename, __dirname) { wetransfertupload.js ${WTU_FILEPATH}

SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions…js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3

How to run an external files in nodejs ? Pleeeeeeease. Thanks by advance.

Hi @kawaiseb,

The Content should be the (node) script content, not a path if you change the runner to node.

Alternatively don’t change the runner, keep it on Bash and run the .js script with something like this content:

#!/usr/bin/env bash
set -ex

node wetransfertupload.js ${WTU_FILEPATH}

Both should work - the point is, the Content input is the actual script content (be it bash, node or anything else) that you want to run.

If you have any questions just let us know! :slight_smile:

1 Like

It works great :slight_smile: Thanks

1 Like

Glad to hear @kawaiseb! :slight_smile: