nunjucks-cli icon indicating copy to clipboard operation
nunjucks-cli copied to clipboard

The "path" argument must be of type string. Received undefined

Open pdehaan opened this issue 3 years ago • 0 comments

Trying to build a simple test.njk file using npx nunjucks-cli "test.njk" but getting an error about the path argument being undefined when it's expecting a string:

npx nunjucks-cli "test.njk"

node:internal/validators:120
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:120:11)
    at resolve (node:path:1098:7)
    at Object.<anonymous> (/private/tmp/11ty-2184/node_modules/nunjucks-cli/main.js:55:18)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v17.3.1

WORKAROUND

Give it an empty -p argument:

npx nunjucks-cli "test.njk" -p ""
Rendering: test.njk

pdehaan avatar Jan 21 '22 05:01 pdehaan