Skip to content

[ERROR] String.prototype.split called on null or undefined #445

Open
@ryangrahamnc

Description

@ryangrahamnc

On a fresh install (when using a tool I made using plop), I'm getting the above error when an action is about to run.
I was able to mess with things to get a stacktrace:

TypeError: String.prototype.split called on null or undefined
    at split (<anonymous>)
    at travel (file:///Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/inquirer/lib/ui/prompt.js:20:10)
    at Object.get (file:///Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/inquirer/lib/ui/prompt.js:27:20)
    at PromptUI.filterIfRunnable (file:///Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/inquirer/lib/ui/prompt.js:159:9)
    at doInnerSub (/Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/rxjs/src/internal/operators/mergeInternals.ts:71:15)
    at outerNext (/Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/rxjs/src/internal/operators/mergeInternals.ts:53:58)
    at OperatorSubscriber.OperatorSubscriber._this._next (/Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts:70:13)
    at OperatorSubscriber.Subscriber.next (/Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/rxjs/src/internal/Subscriber.ts:75:12)
    at <anonymous> (/Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/rxjs/src/internal/operators/mergeInternals.ts:85:24)
    at OperatorSubscriber.OperatorSubscriber._this._next (/Users/ryan/.npm/_npx/08e24d347c8d5920/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts:70:13)

It looks like its because this inquire.js v9 commit removed the default of '' for the path:
SBoudrias/Inquirer.js@ec78662
I dont know if that was on purpose. I also haven't checked into the full trace to see which function plop is calling.

I figure there's a few possible options to get this working:

  • Bug the inquire.js dev to fix a problem in a version that he considers to be legacy. dunno how that would go, but the commit seems to violate semver, so maybe he'll agree its a mistake.
  • Pass in a blank string if we think we'll pass null/undefined. Idk where the call is though, so maybe plop doesnt have the ability to influence the call
  • Update to the v10 release of inquire.js. IDK if theres compatibility issues though, or if this will even fix the issue
  • Hardcode the old inquire.js version in the package.json ("inquirer": "9.3.5")

In the meantime, I've been able to bypass the problem by adding an override into my own tool's package.json:

"overrides": {
    "node-plop": {
        "inquirer": "9.3.5"
    }
},

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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