Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@angular/cli): don't fail install due to node-sass #5282

Merged
merged 1 commit into from
Mar 16, 2017

Conversation

filipesilva
Copy link
Contributor

@filipesilva filipesilva commented Mar 7, 2017

This change should reduce the amount of problems on npm installs.

It makes the node-sass dependency optional, and so install will not fail when it cannot be installed.

For projects that do not use sass, there is no side-effect of an failed node-sass install.

For projects that do use node-sass and the install failed, they should see the following self-explanatory error message:

ERROR in ./src/app/app.component.scss
Module build failed: Error: Missing binding D:\sandbox\master-project\node_modules\node-sass\vendor\win32-x64-51\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 7.x

Found bindings for the following environments:

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to build the binding for your current environment.
    at module.exports (D:\sandbox\master-project\node_modules\node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (D:\sandbox\master-project\node_modules\node-sass\lib\index.js:14:35)

Fix #4429

Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking this for now.

This change should reduce the amount of problems on npm installs.

It makes the `node-sass` dependency optional, and so install will not fail when it cannot be installed.

For projects that do not use sass, there is no side-effect of an failed node-sass install.

For projects that do use node-sass and the install failed, they should see the following self-explanatory error message:

```

ERROR in ./src/app/app.component.scss
Module build failed: Error: Missing binding D:\sandbox\master-project\node_modules\node-sass\vendor\win32-x64-51\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 7.x

Found bindings for the following environments:

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to build the binding for your current environment.
    at module.exports (D:\sandbox\master-project\node_modules\node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (D:\sandbox\master-project\node_modules\node-sass\lib\index.js:14:35)
```
@filipesilva filipesilva changed the title feat(@angular/cli): add node-sass as optional dep fix(@angular/cli): don't fail install due to node-sass Mar 16, 2017
@hansl
Copy link
Contributor

hansl commented Mar 16, 2017

LGTM

@hansl
Copy link
Contributor

hansl commented Mar 16, 2017

I wish there was a way to test this though.

@slashbrackets
Copy link

filipesilva commented on Mar 7 above that the fix was to make node-sass optional which allows the install to continue without failure. However, if a project needs to use node-sass then they get the error that it's missing. What he didn't include is how do you get it if you're behind a firewall that blocks the node-sass binaries?

@filipesilva
Copy link
Contributor Author

@slashbrackets in that case you can add some global variables that tell node-sass where to download the binary from: https://github.com/sass/node-sass#binary-configuration-parameters

You can also setup your system to compile node-sass yourself.

If you cannot do either, then I don't think node-sass can be used at all in your environment.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Angular CLI New project creation issue
4 participants