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

install-app-deps run as a package.json script fails with yarn >= v0.24.0-0.24.4 #1542

Closed
bcomnes opened this issue May 12, 2017 · 10 comments
Closed

Comments

@bcomnes
Copy link
Contributor

bcomnes commented May 12, 2017

  • Version: 17.5.0
  • Target: OSX

When running install-app-deps from a script field in package.json with yarn, it fails in some cases. NPM runs it fine, and older versions of yarn run it fine. Here is an example:

bret-zh:vneck bret$ yarn run postinstall:app-deps
yarn run v0.24.0
$ install-app-deps 
Rebuilding native production dependencies for darwin:x64
Rebuilding native dependency sqlite3
Error: /usr/local/Cellar/node/7.10.0/bin/node exited with code 1
Output:
yarn run v0.24.0
$ node-pre-gyp install --fallback-to-build 
Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Error output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp info build requesting source compile
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/bret/zhealth/vneck/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:77:29)
node-pre-gyp ERR! stack     at emitOne (events.js:96:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:213:12)
node-pre-gyp ERR! stack     at onErrorNT (internal/child_process.js:367:16)
node-pre-gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:80:11)
node-pre-gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:104:9)
node-pre-gyp ERR! stack     at Module.runMain (module.js:607:11)
node-pre-gyp ERR! stack     at run (bootstrap_node.js:427:7)
node-pre-gyp ERR! stack     at startup (bootstrap_node.js:151:9)
node-pre-gyp ERR! System Darwin 16.5.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/7.10.0/bin/node" "/Users/bret/zhealth/vneck/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/bret/zhealth/vneck/node_modules/sqlite3
node-pre-gyp ERR! node -v v7.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok 
error Command failed with exit code 1.

    at ChildProcess.childProcess.once.code (/Users/bret/zhealth/vneck/node_modules/electron-builder-util/src/util.ts:135:14)
    at Object.onceWrapper (events.js:293:19)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at maybeClose (internal/child_process.js:899:16)
    at Socket.<anonymous> (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at Pipe._handle.close [as _onclose] (net.js:511:12)
From previous event:
    at spawn (/Users/bret/zhealth/vneck/node_modules/electron-builder-util/src/util.ts:103:3)
    at /Users/bret/zhealth/vneck/node_modules/electron-builder/src/yarn.ts:117:7
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at /Users/bret/zhealth/vneck/node_modules/electron-builder/src/yarn.ts:115:27
From previous event:
    at rebuild (/Users/bret/zhealth/vneck/node_modules/electron-builder/out/yarn.js:93:22)
    at /Users/bret/zhealth/vneck/node_modules/electron-builder/src/yarn.ts:16:11
    at Generator.next (<anonymous>)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at installOrRebuild (/Users/bret/zhealth/vneck/node_modules/electron-builder/out/yarn.js:33:21)
    at /Users/bret/zhealth/vneck/node_modules/electron-builder/src/cli/install-app-deps.ts:32:2
    at Generator.next (<anonymous>)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
From previous event:
    at main (/Users/bret/zhealth/vneck/node_modules/electron-builder/out/cli/install-app-deps.js:36:21)
    at Object.<anonymous> (/Users/bret/zhealth/vneck/node_modules/electron-builder/out/cli/install-app-deps.js:72:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
    at bootstrap_node.js:542:3
error Command failed with exit code 255.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@develar
Copy link
Member

develar commented May 14, 2017

Yeah, my sample project is also cannot be build using latest stable Yarn.

@develar
Copy link
Member

develar commented May 14, 2017

No, in my case it was unrelated error. Works for me.

@develar
Copy link
Member

develar commented May 14, 2017

Please upgrade yarn to 0.24.4 and try.

@bcomnes
Copy link
Contributor Author

bcomnes commented May 15, 2017

I've reproduced the issue in: https://gist.github.com/bcomnes/a9ee8a16ff5d656371b53462f1fa8d34 even for the latest version of yarn v0.24.4

Looks like node-gyp bins are missing for some reason. Could be upstream? Works with npm for some reason. I'm investigating. If I determine that its an electron-builder issue I'll ping you about it.

@bcomnes bcomnes changed the title install-app-deps run as a package.json script fails with yarn >= v0.24.0 install-app-deps run as a package.json script fails with yarn >= v0.24.0-0.24.4 May 15, 2017
@bcomnes
Copy link
Contributor Author

bcomnes commented May 15, 2017

UPDATE: To correct what I said before, installing node-gyp along side this allows a successful rebuild, but it doesn't seem to be the missing ingredient between the npm vs yarn installs. Trying to sort that out now.

@bcomnes
Copy link
Contributor Author

bcomnes commented May 15, 2017

Perhaps related to yarnpkg/yarn#3240 ? Yarn stopped bundling node-gyp and instead attempts to fallback to npm's. I have npm and yarn installed, but for some reason install-app-deps isn't finding it.

@develar Perhaps we need to compensate for that here?

@bcomnes
Copy link
Contributor Author

bcomnes commented May 16, 2017

Looks like a natural place to fix this is in node-pre-gyp: yarnpkg/yarn#3240 (comment)

@develar
Copy link
Member

develar commented May 17, 2017

Thanks for investigation.

@ajbeaven
Copy link

ajbeaven commented Aug 10, 2017

@bcomnes did you end up resolving this? I'm still hitting this on yarn v0.27.5.

Update
Oops - my build server was appending the --production option to the yarn install task. It obviously needs the devDependencies in order run install-app-deps.

@bcomnes
Copy link
Contributor Author

bcomnes commented Aug 10, 2017

The node-pre-gyp issues persist unfortunately (for spawning), but yeah you are going to need dev-deps for the dev things :P

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

No branches or pull requests

3 participants