react-native-create-library icon indicating copy to clipboard operation
react-native-create-library copied to clipboard

--generate-example does not work with no yarn installed

Open brody4hire opened this issue 6 years ago • 0 comments

Followup to #63 / #75:

If I would install this project as follows:

npm i -g https://github.com/frostney/react-native-create-library

then try generating a library project with --generate-example with no yarn installed:

react-native-create-library --prefix CT --package-identifier com.test --generate-example ModuleTest

it ends up with error messages:

> [email protected] postinstall /Users/brodybits/Documents/bb/ct1/react-native-module-test/example
> node ../scripts/examples_postinstall.js node_modules/react-native-module-test

No node_modules path found at /Users/brodybits/Documents/bb/ct1/react-native-module-test/example/node_modules/react-native-module-test/node_modules. Skipping delete.
Deleting: /Users/brodybits/Documents/bb/ct1/react-native-module-test/example/node_modules/react-native-module-test/example
Error deleting /Users/brodybits/Documents/bb/ct1/react-native-module-test/example/node_modules/react-native-module-test/example: ENOENT: no such file or directory, lstat '/Users/brodybits/Documents/bb/ct1/react-native-module-test/example/node_modules/react-native-module-test/example/node_modules/react-proxy'
npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.52.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.

audited 179259 packages in 64.447s
found 0 vulnerabilities

Command `link` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.
Error while creating library ModuleTest
Error: Command failed: react-native link
    at checkExecSyncError (child_process.js:616:11)
    at execSync (child_process.js:653:13)
    at Promise (/Users/brodybits/.nvs/node/10.15.1-ct1/x64/lib/node_modules/react-native-create-library/lib.js:136:13)
    at new Promise (<anonymous>)
    at exec.then.then (/Users/brodybits/.nvs/node/10.15.1-ct1/x64/lib/node_modules/react-native-create-library/lib.js:119:18)

This does not seem to be intentional: https://github.com/frostney/react-native-create-library/blob/70762697b982515de03e335173de5b814f3b8717/lib.js#L133-L134

I wouldn't mind if this would be solved by explicitly requiring yarn to support the --generate-example flag.

brody4hire avatar Feb 03 '19 22:02 brody4hire