According to GitHub, the node-sass dependency is declared optional in the build-angular package (see https://github.com/angular/angular-cli/blob/v7.1.0/packages/angular_devkit/build_angular/package.json#L56).
However if you npm install version 7.1.0 you get build-angular package version 0.11.0 with node-sass required.
As node-sass requires native libraries this breaks builds in CI systems, even is SASS is not used at all in the application code.
```
Angular CLI: 7.1.0
Node: 11.2.0
OS: darwin x64
Angular: 7.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
@angular-devkit/architect 0.11.0
@angular-devkit/build-angular 0.11.0
@angular-devkit/build-optimizer 0.11.0
@angular-devkit/build-webpack 0.11.0
@angular-devkit/core 7.1.0
@angular-devkit/schematics 7.1.0
@ngtools/webpack 7.1.0
@schematics/angular 7.1.0
@schematics/update 0.11.0
rxjs 6.3.3
typescript 3.1.6
webpack 4.23.1
Hi, node-sass is optional in @angular-devkit/[email protected] https://unpkg.com/@angular-devkit/build[email protected]/package.json
I tried locally, and it seems that if node-sass fails the installation continues as expected.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\node-sass):
Can you provide the actual error message?
After a fresh install with the latest angular-cli node-sass in ./node_modules/@angular-devkit/build-angular/package.json is _not_ optional, it is in the required dependencies.
I spotted the issue on npm install, it's being added as a non optional,
That said that is the norm, as on npm install at least for version 6.4.1, optionalDependencies get added to the dependencies. When failing however this should not terminate the installation.
This is happening for all packages.
node-sass has a post install step that tries to download prebuilt binaries for the target platform and if that fails then tries to compile for that platform. If the compilation fails, the entire installation can fail.
@kdekooter Please fill in the template, without the necessary version and platform information it is incredibly difficult to assist with a problem.
npm install also has a no-optional flag.
no-optional fixes things for my CI-scenario. Closing the issue.
Bumping this up.
When I try to update the angular 7.1.1 project with npm install --no-optional it installs node-sass as well. I don't use sass for any purpose in the project, how can I get rid of it?
C:\project>npm install --no-optional
> [email protected] install C:\project\node_modules\node-sass
> node scripts/install.js
Cached binary found at C:\Users\szellcs\AppData\Roaming\npm-cache\node-sass\4.11.0\win32-x64-64_binding.node
> [email protected] postinstall C:\project\node_modules\node-sass
> node scripts/build.js
Binary found at C:\project\node_modules\node-sass\vendor\win32-x64-64\binding.node
Testing binary
Binary is fine
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
node-sass has a post install step that tries to download prebuilt binaries for the target platform and if that fails then tries to compile for that platform. If the compilation fails, the entire installation can fail.
@kdekooter Please fill in the template, without the necessary version and platform information it is incredibly difficult to assist with a problem.
npm installalso has ano-optionalflag.