Skip to content

Commit 4664551

Browse files
committed
fix: 在Linux环境下导致Error: spawn xxx\node\node ENOENT
希望增加 Linux系统的支持 #53
1 parent ffbe26c commit 4664551

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 0.0.12
4+
* fix: 在Linux环境下导致`Error: spawn xxx\node\node ENOENT` [#53](https://github.com/hb0730/vscode-uniapp-run/issues/53)
5+
-`Windows/Linux`环境下,执行路径为`${HBuilderX}/plugins/`
6+
-`Mac`环境下,执行路径为`${HBuilderX}/Contents/HBuilderX/plugins/`
37

48
### 0.0.11
59

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "uniapp-run",
33
"displayName": "uniapp run",
44
"description": "基于HBuilderX uniapp cli启动",
5-
"version": "0.0.11",
5+
"version": "0.0.12",
66
"engines": {
77
"vscode": "^1.77.0"
88
},

src/core/uniapp/index.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ export interface runtimeArgs {
4343
uniVueVersion: string;
4444
}
4545
export class UniappRuntimeArgs {
46-
private _isWindows: boolean;
46+
// private _isWindows: boolean;
47+
private _isMacOs:boolean;
4748
constructor(public args: runtimeArgs, public config: UnappRunConfig) {
48-
this._isWindows = process.platform === "win32";
49+
// this._isWindows = process.platform === "win32";
50+
this._isMacOs = process.platform === "darwin";
4951
}
5052

5153
/**
@@ -117,7 +119,7 @@ export class UniappRuntimeArgs {
117119
*/
118120
get cwd(): string {
119121
let paths: string[] = ["plugins"];
120-
if (!this._isWindows) {
122+
if (this._isMacOs) {
121123
paths = ["Contents", "HBuilderX", ...paths];
122124
}
123125
if (this.uniVueVersion === "v3") {
@@ -134,7 +136,7 @@ export class UniappRuntimeArgs {
134136
*/
135137
get nodePath(): string {
136138
let paths: string[] = ["plugins", "node", "node"];
137-
if (!this._isWindows) {
139+
if (this._isMacOs) {
138140
paths = ["Contents", "HBuilderX", ...paths];
139141
}
140142
return path.join(this.config.HBuilderPath, ...paths);
@@ -146,7 +148,7 @@ export class UniappRuntimeArgs {
146148
*/
147149
get nodeJsPath(): string {
148150
let paths: string[] = ["plugins"];
149-
if (!this._isWindows) {
151+
if (this._isMacOs) {
150152
paths = ["Contents", "HBuilderX", ...paths];
151153
}
152154
if (this.uniVueVersion === "v3") {

0 commit comments

Comments
 (0)