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

使用egg init创建项目后运行npm run dev报错,你们代码执行命令报错 #222

Closed
AnizGu opened this issue Feb 15, 2023 · 13 comments
Assignees

Comments

@AnizGu
Copy link

AnizGu commented Feb 15, 2023

创建的是typescript项目,发现运行npm run dev报错,json解析语法错误
看了你们代码,在拼接命令参数时使用了单引号包裹了json参数,而且没有做转义处理
image
image

@atian25
Copy link
Member

atian25 commented Feb 15, 2023

https://github.com/eggjs/egg-bin/blob/master/src/cmd/dev.ts#L47

@fengmk2 最新重构的这里好像有问题

@fengmk2
Copy link
Member

fengmk2 commented Feb 15, 2023

我先重现看看

@fengmk2
Copy link
Member

fengmk2 commented Feb 15, 2023

@AnizGu 我使用 https://github.com/eggjs/egg-boilerplate-ts 脚手架没有复现,能否提供一下复现方式。

image

@AnizGu
Copy link
Author

AnizGu commented Feb 15, 2023

@fengmk2
系统:Window 11
1.cmd执行常规操作选择ts simple,安装依赖
image
2.用vscode打开项目运行
image
创建了项目提交到Github地址:https://github.com/AnizGu/egg-example.git

@AnizGu
Copy link
Author

AnizGu commented Feb 15, 2023

原来还有个新的脚手架呀,没发现呢,有官网吗?我还是用以前的脚手架去创建的,不过问题确实存在的

@fengmk2
Copy link
Member

fengmk2 commented Feb 15, 2023

@AnizGu
Copy link
Author

AnizGu commented Feb 15, 2023

@fengmk2
脚手架https://github.com/eggjs/egg-boilerplate-ts
用了wsl去运行还是一样的错误
image

@atian25
Copy link
Member

atian25 commented Feb 16, 2023

@AnizGu 你改下本地的 D:\Developments\EggProjects\showcase\node_modules\egg-bin\scripts\start-cluster. js:4

在前面加一句 console.log(process.argv) 看看输出了啥

@fengmk2
Copy link
Member

fengmk2 commented Feb 16, 2023

看起来是参数解析在 windows 下有兼容性问题,我加一个 encode 来解决吧。

@atian25
Copy link
Member

atian25 commented Feb 16, 2023

咦,这个库的 windows ci 啥时干掉了?

@fengmk2
Copy link
Member

fengmk2 commented Feb 16, 2023

#190 去年11月

@atian25
Copy link
Member

atian25 commented Feb 16, 2023

没必要干掉吧,反正 GitHub Actions 不收费。

@fengmk2
Copy link
Member

fengmk2 commented Feb 17, 2023

#223 @AnizGu 重新安装依赖即可

@fengmk2 fengmk2 closed this as completed Feb 17, 2023
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

3 participants