File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
packages/create-react-native-library/src Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,28 @@ async function create(argv: yargs.Arguments<any>) {
151
151
process . exit ( 1 ) ;
152
152
}
153
153
154
+ try {
155
+ const child = spawn ( 'npx' , [ '--help' ] ) ;
156
+
157
+ await new Promise ( ( resolve , reject ) => {
158
+ child . once ( 'error' , reject ) ;
159
+ child . once ( 'close' , resolve ) ;
160
+ } ) ;
161
+ } catch ( error ) {
162
+ // @ts -expect-error: TS doesn't know about `code`
163
+ if ( error != null && error . code === 'ENOENT' ) {
164
+ console . log (
165
+ `Couldn't find ${ kleur . blue (
166
+ 'npx'
167
+ ) } ! Please install it by running ${ kleur . blue ( 'npm install -g npx' ) } `
168
+ ) ;
169
+
170
+ process . exit ( 1 ) ;
171
+ } else {
172
+ throw error ;
173
+ }
174
+ }
175
+
154
176
let name , email ;
155
177
156
178
try {
You can’t perform that action at this time.
0 commit comments