Missing binding node_modules/node-sass/vendor/darwin-x64-72/binding.node
error: Missing binding YOUR_PROJECT_PATH/node_modules/node-sass/vendor/darwin-x64-72/binding.nodeNode Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.xFound bin
·
起因是我换了电脑,将代码从git上把代码down下来之后
yarn //安装依赖 等同于install
npm run serve //运行程序
先报了一个错误,分析原因是node版本过高,node-sass不支持,然后我看了一下当前电脑版本node@17.+,之前的电脑版本node版本是 v14.16.1,接下来想那就版本一致吧,
Mac切换node版本
npm install -g n //安装n node版本管理
sudo n 14.16.1 // 切换安装到node@14.16.1版本
然后运行代码后,报了如下错误
error: Missing binding YOUR_PROJECT_PATH/node_modules/node-sass/vendor/darwin-x64-72/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x
Found bindings for the following environments:
- OS X 64-bit with Node.js 12.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.
按照提示尝试执行 npm install 和 npm rebuild node-sass 无果后换个思路解决问题。
问题解析:
在目录下 找不到darwin-x64-72/binding.node文件 那我们解决这个问题就好了
解决办法:
1、找到node-sass链接,进入url:https://github.com/sass/node-sass/releases
2、 下载指定版本:在页面中找到报错中你需要的版本,下载到本地
3、在.../node_modules/node-sass/vendor目录下新建目录 darwin-x64-72,将下载的文件放在此目录下,并更名为binding.node。(按照个人需求将下载的文件发在指定目录下)
4、重新运行代码,大功告成!
更多推荐
已为社区贡献4条内容
所有评论(0)