Error installing ^2.0.0 with yarn
Opened this issue · 8 comments
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
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.
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
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
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.
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
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.
-
remove the package-lock.json
-
Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh
-
Install typescript globally
npm install typescript -g
-
Close all terminals
-
Open new terminal and run
npm install
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"
Nevertheless solving #9 would be a cleaner and better solution regarding CI/CD...