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

Error installing ^2.0.0 with yarn #8

Open
rafaelmaeuer opened this issue Jun 30, 2021 · 8 comments
Open

Error installing ^2.0.0 with yarn #8

rafaelmaeuer opened this issue Jun 30, 2021 · 8 comments

Comments

@rafaelmaeuer
Copy link

rafaelmaeuer commented Jun 30, 2021

When I try to install any version > 2.0.0 with yarn on macOS, I get following error:

[5/5] 🔨  Building fresh packages...
error /<project-path>/node_modules/node-crc: Command failed.
Exit code: 1
Command: npm run build
Arguments: 
Directory: /<project-path>/node_modules/node-crc
Output:
> node-crc@2.0.10 build
> cargo-cp-artifact -nc index.node -- cargo build --release --message-format=json-render-diagnostics && tsc

Error: could not find the `cargo` executable.

You can find instructions for installing Rust and Cargo at:

    https://www.rust-lang.org/tools/install


Did not copy "cdylib:node-crc"
npm ERR! code 1
npm ERR! path /<project-path>/node_modules/node-crc
npm ERR! command failed
npm ERR! command sh -c cargo-cp-artifact -nc index.node -- cargo build --release --message-format=json-render-diagnostics && tsc

npm ERR! A complete log of this run can be found in:
npm ERR!     /<user-path>/.npm/_logs/2021-06-30T13_29_53_039Z-debug.log

Find the log-file attached:
2021-06-30T13_29_53_039Z-debug.log

@magiclen
Copy link
Owner

magiclen commented Jul 1, 2021

You need to set up the development environment for Rust to compile the binary.

You can simply install rustup with this command: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh. By default, it would also install the stable Rust compiler and the cargo command tool, which should be enough to build/install this project.

@rafaelmaeuer
Copy link
Author

rafaelmaeuer commented Jul 20, 2021

After installing rustup, I get another error (macOS 11.4, node 16.5.0, npm 7.20.0, yarn 1.23.0):

error /Users/<project-path>/node_modules/node-crc: Command failed.
Exit code: 127
Command: npm run build
Arguments: 
Directory: /Users/<project-path>/node_modules/node-crc
Output:
> node-crc@2.0.10 build
> cargo-cp-artifact -nc index.node -- cargo build --release --message-format=json-render-diagnostics && tsc

    Updating crates.io index
   Compiling typenum v1.13.0
   Compiling proc-macro2 v1.0.27
   Compiling version_check v0.9.3
   Compiling unicode-xid v0.2.2
   Compiling neon-build v0.8.3
   Compiling syn v1.0.73
   Compiling stable_deref_trait v1.2.0
   Compiling cfg-if v1.0.0
   Compiling byteorder v1.4.3
   Compiling heapless v0.5.6
   Compiling semver-parser v0.7.0
   Compiling smallvec v1.6.1
   Compiling cslice v0.2.0
   Compiling libloading v0.6.7
   Compiling hash32 v0.1.1
   Compiling semver v0.9.0
   Compiling generic-array v0.14.4
   Compiling neon-runtime v0.8.3
   Compiling neon v0.8.3
   Compiling quote v1.0.9
   Compiling generic-array v0.12.4
   Compiling generic-array v0.13.3
   Compiling as-slice v0.1.5
   Compiling crc-any v2.3.12
   Compiling neon-macros v0.8.3

@rafaelmaeuer
Copy link
Author

On docker build with github-actions I get:

error /web/app/node_modules/node-crc: Command failed.
Exit code: 101
Command: npm run build
Arguments: 
Directory: /web/app/node_modules/node-crc
Output:
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1626782438614-0.7731101187450118/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> node-crc@2.0.10 build /web/app/node_modules/node-crc
> cargo-cp-artifact -nc index.node -- cargo build --release --message-format=json-render-diagnostics && tsc

    Updating crates.io index
 Downloading crates ...
  Downloaded crc-any v2.3.12
  Downloaded neon v0.8.3
  Downloaded heapless v0.5.6
  Downloaded smallvec v1.6.1
  Downloaded cslice v0.2.0
  Downloaded neon-build v0.8.3
  Downloaded semver v0.9.0
  Downloaded neon-runtime v0.8.3
  Downloaded neon-macros v0.8.3
  Downloaded generic-array v0.13.3
  Downloaded stable_deref_trait v1.2.0
  Downloaded as-slice v0.1.5
  Downloaded quote v1.0.9
  Downloaded cfg-if v1.0.0
  Downloaded semver-parser v0.7.0
  Downloaded syn v1.0.73
  Downloaded libloading v0.6.7
  Downloaded generic-array v0.14.4
  Downloaded proc-macro2 v1.0.27
  Downloaded typenum v1.13.0
  Downloaded generic-array v0.12.4
  Downloaded hash32 v0.1.1
  Downloaded unicode-xid v0.2.2
  Downloaded version_check v0.9.3
  Downloaded byteorder v1.4.3
   Compiling typenum v1.13.0
   Compiling proc-macro2 v1.0.27
   Compiling version_check v0.9.3
   Compiling unicode-xid v0.2.2
   Compiling neon-build v0.8.3
   Compiling syn v1.0.73
   Compiling cfg-if v1.0.0
   Compiling byteorder v1.4.3
   Compiling stable_deref_trait v1.2.0
   Compiling heapless v0.5.6
   Compiling smallvec v1.6.1
   Compiling semver-parser v0.7.0
   Compiling cslice v0.2.0
   Compiling generic-array v0.14.4
   Compiling libloading v0.6.7
error[E0658]: the `#[non_exhaustive]` attribute is an experimental feature
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libloading-0.6.7/src/error.rs:23:1
   |
23 | #[non_exhaustive]
   | ^^^^^^^^^^^^^^^^^
   |
   = note: for more information, see https://github.com/rust-lang/rust/issues/44109

error: aborting due to previous error

@magiclen
Copy link
Owner

error[E0658]: the #[non_exhaustive] attribute is an experimental feature

It seems that your Rust is too old... (see https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1400-2019-12-19)

You don't need to use docker. Just run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh to install Rust and Cargo into your environment.

@rafaelmaeuer
Copy link
Author

ok but I do use docker in my build pipeline, so updating this dependency to v2 requires me to integrate rust, if not someone will perform suggestions of #9 eventually

@hk-tony
Copy link

hk-tony commented Mar 17, 2022

I just ran into the same issue and made it work by the following steps on my M1 Pro Macbook Pro.
Not sure if it helps for others.

  1. remove the package-lock.json

  2. Install rustup
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh

  3. Install typescript globally
    npm install typescript -g

  4. Close all terminals

  5. Open new terminal and run npm install

@rafaelmaeuer
Copy link
Author

Thanks @hk-tony I was finally able to get v2 running with following steps:

Add typescript as dev-dependency to package.json

yarn add typescript --dev

Install rustup toolchain on MacOS

# for Intel or M1 macs
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh

Add rustup toolchain to Docker

# for alpine-based images
RUN apk add rustup build-base
RUN rustup-init -y
ENV PATH "/root/.cargo/bin:$PATH"
ENV RUSTFLAGS="-C target-feature=-crt-static"

@rafaelmaeuer
Copy link
Author

rafaelmaeuer commented Mar 21, 2022

Nevertheless solving #9 would be a cleaner and better solution regarding CI/CD...

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

Successfully merging a pull request may close this issue.

3 participants