Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

postinstall works only on iOS #256

Closed
kbzowski opened this issue Aug 9, 2019 · 7 comments
Closed

postinstall works only on iOS #256

kbzowski opened this issue Aug 9, 2019 · 7 comments

Comments

@kbzowski
Copy link

kbzowski commented Aug 9, 2019

Creating a new project with ignite-bowser on Windows 10 ends with an error:.

09:39:27 [ignite] running add() on ignite plugin
√ added ignite-bowser in 47s
- ▸ installing react-native-gesture-handler@^1.3.0 09:39:27 [ignite] yarn add react-native-gesture-handler@^1.3.0
an error occured while installing ignite-bowser boilerplate.
Error: Command failed: yarn
System cannot find the path specified.
error Command failed with exit code 1.

    at ChildProcess.exithandler (child_process.js:297:12)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn',
  stderr: 'System cannot find the path specified.\r\n' +
    'error Command failed with exit code 1.\n'
}
error installing boilerplate

I guess the blame is on the postinstall script, which assumes that cocoapods is installed (which is available AFAIK only for iOS).

"postinstall": "solidarity && jetify && (cd ios; pod install)",

Removing last part of the script fixes the problem.


ignite doctor results:

  platform           win32

  arch               x64
  cpu                8 cores                             Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  directory          f:\PRACA\PRIV_PROJECT\conf-mobile

JavaScript
  node               12.6.0       C:\Program Files\nodejs\node.EXE
  npm                6.9.0        C:\Program Files\nodejs\npm.CMD
  yarn               1.17.3       C:\Program Files (x86)\Yarn\bin\yarn.CMD

React Native
  react-native-cli   2.0.1

Ignite
  ignite-cli         3.1.6        C:\Users\Krzysztof\AppData\Local\Yarn\bin\ignite.CMD

Android
  java               -            C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.EXE
  android home       -            D:\Android\SDK
@kbzowski kbzowski closed this as completed Aug 9, 2019
@kbzowski kbzowski reopened this Aug 9, 2019
@RaitoBezarius
Copy link

I confirm this issue, I'm on Linux, I get this error before the postinstall makes node gives up: sh: pod: command not found

@RaitoBezarius
Copy link

Related to: #231

@RaitoBezarius
Copy link

I implemented a fix in the boilerplate "bowser-postfinall-fixed" to install with: ignite new MyProject -b bower-postinstall-fixed: https://github.com/RaitoBezarius/ignite-bowser — I'll open a PR

@FrederickEngelhardt
Copy link

FrederickEngelhardt commented Aug 11, 2019

@kbzowski for react-native 0.60.4 you will need cocoapods for iOS linking and AFAIK iOS development.

This case could be solved by adding postinstall script which detects if the user either has darwin or we could detect if pod exists in path.

Example:

create a file called postinstall.js

const { exec } = require('child_process')
if (process.platform === 'darwin') {
	exec('yarn link:ios', (error, stdout, stderr) => {
		console.log(stdout);
		console.log(stderr);
		if (error !== null) {
			console.log(`exec error: ${error}`);
		}
	})
}

In package json under scripts we would replace postinstall like this:
"postinstall": "node postinstall.js"

@kevinvangelder
Copy link
Member

infinitered/ignite#1456 Is an initial fix for this issue. Hopefully we'll get a chance to implement a more robust fix in the near future.

@imadmk
Copy link

imadmk commented Sep 25, 2019

I successfully created a project with Linux Bash Shell on windows 10. Need some works if you never install it before.

@jamonholmgren jamonholmgren transferred this issue from infinitered/ignite Sep 26, 2019
@jamonholmgren
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants