服务器安装node-sass报错 2020-05-26

本地加了package.json加了node-sass安装没有问题,提交到服务器上安装node-sass失败,用了npm , yarn ,cnpm 均安装失败

1、依赖下载完后报错,直接执行npm run build提示

Run npm rebuild node-sass to download the binding for your current environment

2、执行npm rebuild node-sass后报错提示

gyp ERR! stack Error: EACCES: permission denied, mkdir '/opt/app/tod/todweb-develop/node_modules/node-sass/.node-gyp'

3、执行sudo npm rebuild node-sass后报错提示


Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x

4、访问https://github.com/sass/node-sass/releases 找到报错提示相应版本的node下载后复制到提示路径下,并将文件名修改为binding.node

cp ./linux-x64-72_binding.node ../node_modules/node-sass/vendor/linux-x64-72/binding.node

5、执行npm rebuild node-sass解决

你可能感兴趣的:(服务器安装node-sass报错 2020-05-26)