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

Use relative command paths in distributed CLIs #12

Closed
JennerChen opened this issue May 28, 2019 · 3 comments
Closed

Use relative command paths in distributed CLIs #12

JennerChen opened this issue May 28, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@JennerChen
Copy link

I just try to use pastel write a demo cli project. After I publish package and install&run it on my target server. It throw error below.

/Users/0004112/temp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Cannot find module '/Users/zhangqing/Documents/web/pastel-demo/build/commands/index.js'

I found the bug is located in the generated commands.json file , command.path is my dev machine path.

{
	"commands": [
		{
			"path": "/Users/zhangqing/Documents/web/pastel-demo/commands/index.js",
			"buildPath": "/Users/zhangqing/Documents/web/pastel-demo/build/commands/index.js",
			"name": "index",
			"description": "This is my command description",
			"args": [
				{
					"key": "name",
					"type": "string",
					"description": "This is \"name\" option description",
					"isRequired": true,
					"aliases": [
						"n"
					],
					"positional": false
				}
			],
			"subCommands": []
		},
		{
			"path": "/Users/zhangqing/Documents/web/pastel-demo/commands/posts/index.js",
			"buildPath": "/Users/zhangqing/Documents/web/pastel-demo/build/commands/posts/index.js",
			"name": "posts",
			"description": "",
			"args": [],
			"subCommands": []
		}
	]
}

I am new to pastel, I don't know whether is my mistake or it is a bug in pastel.
here is my demo package:
npm:https://www.npmjs.com/package/@mogul/hello-person-demo
git: https://github.com/JennerChen/try-pastel-person-demo
env:
nodejs: 8.12.0
pasteljs: 1.0.1

@MihaiVoinea
Copy link

MihaiVoinea commented May 28, 2019

I also had this issue with my package.

https://github.com/mihaivoinea/makerlog-cli

I used create-pastel-app to generate the boilerplate.

I tried to manually change the command path and publish that but was unable to get it to work.

@vadimdemedes
Copy link
Owner

Good catch! Will publish a fix soon.

@vadimdemedes vadimdemedes added the bug Something isn't working label Jun 1, 2019
@vadimdemedes vadimdemedes changed the title use distribution package throw command not found Use relative command paths in distributed CLIs Jun 1, 2019
vadimdemedes pushed a commit that referenced this issue Jun 1, 2019
@vadimdemedes
Copy link
Owner

Released a fix as 1.0.2. You need to rebuild and publish a new version of your CLI to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants