bitwarden / web

The website vault (vault.bitwarden.com).
https://vault.bitwarden.com
Other
2.58k stars 406 forks source link

Build issue with fix caused by node-sass (gyp) if no python2 is installed #705

Closed MartB closed 3 years ago

MartB commented 3 years ago

Hey,

when building without python2 installed (Fedora 33) node-gyp which is required by node-sass errors out.

gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /usr/bin/python3 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                       ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:308:12)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
gyp ERR! System Linux 5.8.18-300.fc33.x86_64
gyp ERR! command "/usr/bin/node" "/opt/bitwarden/webvault/web-vault/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="

Applying the following quick and dirty patch solves it:

diff --git a/package.json b/package.json
index f496bb44..b52b8c0f 100644
--- a/package.json
+++ b/package.json
@@ -51,8 +51,8 @@
     "html-loader": "^0.5.5",
     "html-webpack-plugin": "^3.2.0",
     "mini-css-extract-plugin": "^0.9.0",
-    "node-sass": "^4.13.1",
-    "sass-loader": "^7.1.0",
+    "node-sass": "^5.0.0",
+    "sass-loader": "^10.1.0",
     "style-loader": "^0.23.0",
     "terser-webpack-plugin": "^1.2.3",
     "ts-loader": "^7.0.5",
@@ -61,7 +61,7 @@
     "typescript": "3.8.3",
     "webpack": "^4.29.0",
     "webpack-cli": "^3.2.1",
-    "webpack-dev-server": "^3.1.14"
+    "webpack-dev-server": "^3.11.0"
   },
   "dependencies": {
     "@angular/animations": "9.1.12",
@@ -83,10 +83,10 @@
     "core-js": "2.6.2",
     "duo_web_sdk": "git+https://github.com/duosecurity/duo_web_sdk.git#410a9186cc34663c4913b17d6528067cd3331f1d",
     "font-awesome": "4.7.0",
-    "jquery": "3.4.1",
+    "jquery": "^3.5.1",
     "lunr": "2.3.3",
     "ngx-infinite-scroll": "7.0.1",
-    "node-forge": "0.7.6",
+    "node-forge": "^0.10.0",
     "papaparse": "4.6.0",
     "popper.js": "1.14.4",
     "qrious": "4.0.2",
djsmith85 commented 3 years ago

Hi @MartB thank you for the report and possible fix. With us recently replacing node-sass (which was deprecated) in favor of sass, this issue shouldn't come up anymore. sass does not rely on node-gyp, hence no need to compile it with python.