Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Unable to build on macOS #19

Closed
JonnyWalker81 opened this issue Mar 6, 2018 · 25 comments
Closed

Unable to build on macOS #19

JonnyWalker81 opened this issue Mar 6, 2018 · 25 comments

Comments

@JonnyWalker81
Copy link

When I execute npm install then npm start I get the following error:

Compiling xray_node v0.1.0 (file:///Users/jrothberg/Repositories/xray/xray_node)
error[E0463]: can't find crate for napi
--> src/lib.rs:1:1
|
1 | extern crate napi;
| ^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

If you want more information on this error, try using "rustc --explain E0463"
error: Could not compile xray_node.

To learn more, run the command again with --verbose.
child_process.js:614
throw err;
^

Error: Command failed: cargo rustc --release -- -Clink-args="-undefined dynamic_lookup -export_dynamic"
at checkExecSyncError (child_process.js:574:11)
at Object.execSync (child_process.js:611:13)
at Object. (/Users/jrothberg/Repositories/xray/napi/scripts/napi.js:31:8)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:190:16)

I am building with Rust 1.24.1 (I have also tried building with nightly and get the same result).

@nathansobo
Copy link

Can you try running this inside of xray_electron instead of xray_node?

@JonnyWalker81
Copy link
Author

I am inside of xray_electron when I execute npm install and npm start

@nathansobo
Copy link

Sorry, of course. I misread a path in the beginning of your error message as your working directory. My bad. Let me look at this...

@JonnyWalker81
Copy link
Author

I used nvm to install the specified version of node and if I clear out the node_modules directory then execute npm install it will install the node modules then start building the Rust code and then it fails with the extern crate napi; error. Thank you for looking into this, I am very curious to play around with Xray, I have been doing research on CRDT's and collaborative editing recently for a project at work.

@nathansobo
Copy link

xray_node contains a Cargo.toml file which refers to napi in the sibling folder via a relative symbolic link. Cargo should be resolving extern crate napi based on the path specified. "It works on my machine?" 🤷‍♂️

Okay, troubleshooting a bit, what if you run npm run build inside of xray_node. Same issue? Can you build napi/test_module via npm run build?

@JonnyWalker81
Copy link
Author

When I do both of those suggestions I get the same issue. I agree the Cargo.toml file looks correct and it should be picking it up, but for some reason its not, very weird.

@frenchbread
Copy link

frenchbread commented Mar 6, 2018

I have the same issue as @JonnyWalker81 but I as was able to build

Can you build napi/test_module via npm run build?

@nathansobo
Copy link

macOS versions? Cargo versions? In absence of my ability to reproduce this is tricky.

@JonnyWalker81
Copy link
Author

cargo 0.25.0 (96d8071da 2018-02-26)
macOS: version 10.12.6 (16G29)
node: v8.9.3
rustc: 1.24.1 (also tried with current nightly and beta)

@nathansobo
Copy link

I'm on macOS 10.13.2, but that does seem to be an unlikely culprit.

@JonnyWalker81
Copy link
Author

I tried it on my other computer as well which has 10.13 and had the same issue.

@nathansobo
Copy link

npm -v
5.6.0

@JonnyWalker81
Copy link
Author

Even more strange is that xray_code is referenced in the same way and that seems to build and be referenced correctly. I moved the lines in src/lib.rs to have extern crate xray_core; first and that seems to build and still have the napi crate fail (not a very scientific experiment but figured I would see if it changed anything).

@JonnyWalker81
Copy link
Author

I just updated npm to version 5.7.1 (I was on 5.5.1), when I did npm i npm I got upgraded to version 5.7.1, hopefully that is not an issue.

@nathansobo
Copy link

Thanks for hammering on this. I'm really sorry this is such a pain. Anything else I can try for you?

@JonnyWalker81
Copy link
Author

Can you remove your node_modules folder (inside of xray_electron) and then do npm install --verbose and send me the log. I can see if its going down a different path or something.

@nathansobo
Copy link

Sorry for the delay. Ran the build and then got distracted by something else. Hope this gives some clue.

verbose-build-output.txt.zip

@jparr721
Copy link

jparr721 commented Mar 7, 2018

I am having the same issues on my end. Specs are as follows:
macOS: version 10.13.1
cargo 0.23.0-nightly (e447ac7e9 2017-09-27)
node: v9.7.1
rustc 1.22.0-nightly (f1b5225e8 2017-10-01)

Error output is the same as above. I tried different versions as well.

@ab-gh
Copy link

ab-gh commented Mar 7, 2018

same error here:

`> Xray@0.1.0 start /Users/xxx/xray/xray_electron

electron .
/Users/xxx/xray/xray_electron/node_modules/electron/index.js:9
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
^
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at Object. (/Users/xxx/xray/xray_electron/node_modules/electron/index.js:9:9)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object. (/Users/xxx/xray/xray_electron/node_modules/electron/cli.js:3:16)
at Module._compile (module.js:635:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Xray@0.1.0 start: electron .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Xray@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxx/.npm/_logs/2018-03-07T09_56_59_065Z-debug.log`
MacOS version 10.13 (17A405)
Node v8.9.3
NPM 5.5.1

@JosephTLyons
Copy link

I’m also unable to build. Is there a GUI for this yet? I know it is early, but I figured no harm in asking. I mainly wanted to build it to see what it looked like currently. Anyone have an screenshots if so?

@meain
Copy link

meain commented Mar 7, 2018

I am able to build on my macOS. I am seeing code on the screen but not able to edit anything.
Versions for all are given below.

 = cargo --version
cargo 0.25.0 (8c93e0895 2018-02-01)

 = npm --version
5.7.1

@benkahle
Copy link

benkahle commented Mar 7, 2018

I was also able to build successfully on macOS (10.13.3) with these versions:

> cargo --version
cargo 0.26.0-beta (41480f5cc 2018-02-26)
> npm --version
5.6.0
> node --version
v8.9.4

I also tried npm run build in 'xray_node' and it compiled successfully again.

@JonnyWalker81
Copy link
Author

I just did a pull and am able to build now, not sure exactly what changed to make it be able to build now. Hopefully, others can also build with the latest changes.

@jparr721
Copy link

jparr721 commented Mar 9, 2018

Still no luck building. Perhaps I am missing something? I am inside of xray_electron, but npm install always returns an error saying:
error: unexpected close delimiter: ]
--> /Users/Jarred/Desktop/Programming/xray/xray/napi/src/sys/bindings.rs:2187:32
|
2187 | #[derive(Copy, Clone)]; 4usize ] , }#[test]
| ^

error: Could not compile napi.

@nathansobo
Copy link

I'm going to close this out because we're going to make a pretty big shift in our architecture that will probably change the build situation. I'll be writing about it today or Monday. If after that change (some time next week) there are new issues building, feel free to reopen. Thanks again for your interest.

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

8 participants