mac m1/m2芯片 运行NPM

在mac电脑上执行 npm install时,报错:Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/darwin-arm64-83_binding.node"

Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/darwin-arm64-83_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@4.14.1 postinstall /Users/lightsun/workspace/admin-vue/node_modules/element-theme/node_modules/node-sass
> node scripts/build.js

可以使用以下方法解决:

# 先卸载旧的node

#终端切换至x86_64架构
arch -x86_64 zsh

# 再使用nvm安装node@14
nvm install 14
nvm use 14


# 终端切换至arm64架构
arch -arm64 zsh

之后,有可以出现以下问题,可以

 ERROR  Failed to compile with 1 error                                                                                    5:28:10 PM

 error  in ./src/App.vue?vue&type=style&index=0&id=59827d86&prod&lang=scss

Syntax Error: ModuleError: Module Error (from ./node_modules/sass-loader/dist/cjs.js):
Missing binding /Users/lightsun/workspace/admin-vue/node_modules/node-sass/vendor/darwin-x64-83/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 14.x

Found bindings for the following environments:
  - OS X Unsupported architecture (arm64) with Node.js 14.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.


 @ ./src/App.vue?vue&type=style&index=0&id=59827d86&prod&lang=scss 1:0-496 1:0-496
 @ ./src/App.vue
 @ ./src/main.js
 @ multi ./src/main.js

 ERROR  Build failed with errors.

可能使用以下命令修复,注,必要时,可以再次修改到x84下再执行

npm rebuild node-sass


npm update

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值