I'm using node 14 and Jenkins behind a corporate proxy I can't get node-sass to install properly.
So I've installed it locally in two places
/var/jenkins_home/linux-x64-83_binding.node
/var/jenkins_home/vendor/linux-x64-83/binding.node
I tried SASS_BINARY_PATH
:
SASS_BINARY_PATH=/var/jenkins_home/linux-x64-83_binding.node npm install node-sass
npm install --no-lockfile
npm run build
But I get this error when building:
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): Error: ENOENT: no such file or directory, scandir '/var/jenkins_home/workspace/root_project_dir/project/node_modules/node-sass/vendor'
And I tried SASS_BINARY_DIR
:
SASS_BINARY_DIR=/var/jenkins_home/vendor npm install node-sass
npm install --no-lockfile
npm run build
But this ends up trying to download the binary which is the problem I'm trying to avoid in the first place.
Any help would be greatly appreciated!
Here's my package.json if that helps:
{
"name": "name",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@types/lodash": "4.14.115",
"axios": "^0.18.0",
"@types/chart.js": "^2.7.48",
"chart.js": "^2.7.2",
"chartjs-plugin-datalabels": "0.7.0",
"http2": "^3.3.7",
"lodash": "4.17.10",
"typescript": "^3.2.0",
"vue": "^2.5.16",
"vue-async-computed": "^3.3.1",
"vue-chartjs": "^3.4.0",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0",
"vue-router": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.0-rc.12",
"@vue/cli-plugin-typescript": "^3.0.0-beta.15",
"@vue/cli-service": "^3.0.0-beta.15",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"vue-template-compiler": "^2.5.16"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
I solved this by manually creating the node_modules/node-sass/vendor
directory after npm install
and copying the binding.node
into the linux-x64-83
directory:
npm install node-sass --sass-binary-path="/var/jenkins_home/linux-x64-83_binding.node"
npm install --no-lockfile
mkdir -p node_modules/node-sass/vendor/linux-x64-83
cp /var/jenkins_home/linux-x64-83_binding.node node_modules/node-sass/vendor/linux-x64-83/binding.node
npm run build