The project had node-sass as a dependency, which:
- Requires Python 2 for building native bindings
- Python 2 reached end-of-life and is no longer available on modern systems
- Causes build failures with errors like:
gyp verb check python checking for Python executable "python2"
Commit: [commit hash will be added]
-
Removed
node-sassfrom dependenciesnode-sassv7.0.0 was removed frompackage.json- This package is deprecated and no longer maintained
-
Added
sass(Dart Sass) to devDependenciessassv1.69.5 was added topackage.json- Dart Sass is the official replacement for node-sass
- No Python required - pure JavaScript implementation
- Faster and more reliable
- Angular 14 uses
@angular-devkit/build-angularwhich includes support for Dart Sass - The project's SCSS files are compiled using Angular's build system, not node-sass directly
- Dart Sass is backward compatible with node-sass syntax
@ionic/app-scriptsstill has node-sass as a transitive dependency, but it's not used since the project uses Angular CLI (ngcommands)
The fix was verified by:
- Removing node-sass from package.json
- Adding sass to devDependencies
- Running
npm install --legacy-peer-deps --ignore-scripts - Running
npm run buildsuccessfully
Build completes without errors and SCSS files are compiled correctly.
If you encounter build issues related to node-sass or Python:
-
Delete
node_modulesandpackage-lock.json:rm -rf node_modules package-lock.json
-
Install dependencies:
npm install --legacy-peer-deps --ignore-scripts
-
Build the project:
npm run build
The --ignore-scripts flag prevents chromedriver download issues in environments without internet access.
Consider removing @ionic/app-scripts from devDependencies since:
- The project uses Angular CLI exclusively
- It's an older Ionic build tool no longer needed
- It pulls in the old node-sass v4.14.1 as a transitive dependency
However, this removal should be done carefully with thorough testing to ensure no build scripts depend on it.