Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while linking : path.split is not a function #4

Open
nakwa opened this issue Mar 10, 2020 · 6 comments
Open

Error while linking : path.split is not a function #4

nakwa opened this issue Mar 10, 2020 · 6 comments

Comments

@nakwa
Copy link

nakwa commented Mar 10, 2020

Hi,
I got this error since upgrading node and npm :

Node: v13.9.0
npm: 6.13.7
ZSH 5.7.1 on OSX. 

Log:

$:~/app$ ppl link-file
[INFO] Re-linking all packages from package-links.json
[ERROR] Error while linking:
 TypeError: path.split is not a function
    at Object.projectRoot (/Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/actions/paths.js:7:18)
    at JSONFile.path (/Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/json-file.js:47:24)
    at JSONFile.<anonymous> (/Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/json-file.js:55:29)
    at step (/Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/json-file.js:32:23)
    at Object.next (/Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/json-file.js:13:53)
    at /Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/json-file.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/json-file.js:3:12)
    at JSONFile.get (/Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/json-file.js:51:16)
    at Command.<anonymous> (/Users/user/.nvm/versions/node/v13.9.0/lib/node_modules/persistent-package-linker/dist/actions/relink.js:47:52)
[SUCCESS] Done!
[root-path] resolved: /app

package-links.json:

{
	"isLinked": null,
	"links": [
		"package1",
		"package2"
	]
}

Both package1 and package2 are built and linked (npm link locally).

Any idea what the problem might be?

Thanks!!

@ties-s
Copy link
Owner

ties-s commented Mar 10, 2020

I’ll try to see if I can replicate this!

@nakwa
Copy link
Author

nakwa commented Mar 10, 2020

Thanks!
Looking at the code right now, trying to see if I can find out why this is happening.

(Btw, I also tried removing package-link, relinking, ppl relink, ppl setup, etc)

@ties-s
Copy link
Owner

ties-s commented Mar 10, 2020

Can you try if the ppl-relink command works for you?

@nakwa
Copy link
Author

nakwa commented Mar 10, 2020

ppl-relink works fine.

it seems like the first arg passed to actions/relink.ts when calling ppl link-file isn't an actual string path, but a command :

export async function relink(cwd: string = process.cwd()) {
        console.log('--> RELINKING', cwd);
	log.info('Re-linking all packages from package-links.json')
$:~/app(master)$ ppl link-file
--> RELINKING <ref *1> Command {
  commands: [],
  options: [],
  _execs: {},
  _allowUnknownOption: false,
  _args: [],
  _name: 'link-file',
  _noHelp: false,
  parent: Command {
    commands: [ [Command], [Circular *1], [Command], [Command] ],
    options: [],
    _execs: {},
    _allowUnknownOption: false,
    _args: [],
    _name: 'ppl',
    Command: [Function: Command],
    Option: [Function: Option],
    _events: [Object: null prototype] {
      'command:link': [Function: listener],
      'command:link-file': [Function: listener],
      'command:unlink': [Function: listener],
      'command:setup': [Function: listener]
    },
    _eventsCount: 4,
    rawArgs: [
      '/Users/nakwa/.nvm/versions/node/v13.9.0/bin/node',
      '/Users/nakwa/.nvm/versions/node/v13.9.0/bin/ppl',
      'link-file'
    ],
    args: [ [Circular *1] ]
  }
}
[INFO] Re-linking all packages from package-links.json

that's weird but at least that explains why split is undefined
must be coming from the "commander" package

@ties-s
Copy link
Owner

ties-s commented Mar 10, 2020

Yep found the same. You can use ppl-relink for now. I'm working on fixing this!

@nakwa
Copy link
Author

nakwa commented Mar 10, 2020

cool,thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants