Skip to content

The "from" argument must be of type string. Received type undefined #1326

@stefdelec

Description

@stefdelec

I am trying to use steps I wrote and publish on npm
Here is the error I have:

> cucumber-js e2e/src/**/*.feature --require ./node_modules/@myProject/uat/dist/*.step.js

TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.relative (path.js:1162:5)
at getDefinitionLineAndUri (/home/myname/Documents/myProject/mysubProjectV2/node_modules/@myProject/uat/node_modules/cucumber/lib/support_code_library_builder/build_helpers.js:184:27)
at buildStepDefinitionConfig (/home/myname/Documents/myProject/mysubProjectV2/node_modules/@myProject/uat/node_modules/cucumber/lib/support_code_library_builder/build_helpers.js:124:7)
at SupportCodeLibraryBuilder.defineStep (/home/myname/Documents/myProject/mysubProjectV2/node_modules/@myProject/uat/node_modules/cucumber/lib/support_code_library_builder/index.js:51:79)
at Object.<anonymous> (/home/myname/Documents/myProject/mysubProjectV2/node_modules/@myProject/uat/dist/click.step.js:40:12)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at supportCodePaths.forEach.codePath (/home/myname/Documents/myProject/mysubProjectV2/node_modules/cucumber/lib/cli/index.js:142:42)
at Array.forEach (<anonymous>)
at Cli.getSupportCodeLibrary (/home/myname/Documents/myProject/mysubProjectV2/node_modules/cucumber/lib/cli/index.js:142:22)

I have found that this is this.cwd which is undefined. What can i do?
image

If I copy paste my steps in the root directory (where the package.json is), I don't have any error. So the problem is: I cannot not --require from node_modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions