File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ impl Project {
153
153
init_git ( & self . project_name , project_path_str. as_str ( ) ) ?;
154
154
let auto_install = self . auto_install . unwrap_or ( true ) ;
155
155
if auto_install {
156
- install_deps ( & self . npm , || self . call_success ( ) ) . await ?;
156
+ install_deps ( & self . npm , project_path_str . as_str ( ) , || self . call_success ( ) ) . await ?;
157
157
} else {
158
158
self . call_success ( ) ;
159
159
}
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ where
128
128
}
129
129
}
130
130
131
- pub async fn install_deps < F > ( npm : & NpmType , cb : F ) -> anyhow:: Result < ( ) >
131
+ pub async fn install_deps < F > ( npm : & NpmType , project_path : & str , cb : F ) -> anyhow:: Result < ( ) >
132
132
where
133
133
F : FnOnce ( ) ,
134
134
{
@@ -139,6 +139,10 @@ where
139
139
"执行安装项目依赖 {}, 需要一会儿..." ,
140
140
style( command. to_owned( ) + " install" ) . cyan( ) . bold( )
141
141
) ;
142
+
143
+ // 确保在项目目录中执行
144
+ env:: set_current_dir ( project_path) ?;
145
+
142
146
let output = execute_command ( command, & [ "install" ] ) . await ;
143
147
match output {
144
148
result:: Result :: Ok ( _) => {
You can’t perform that action at this time.
0 commit comments