File: TROUBLESHOOTING.md

package info (click to toggle)
node-node-sass 9.0.0%2Bgit20240724.107ded9%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 75,520 kB
  • sloc: javascript: 7,314; cpp: 1,495; perl: 428; makefile: 11
file content (286 lines) | stat: -rw-r--r-- 8,092 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# Troubleshooting

This document covers some common node-sass issues and how to resolve them. You
should always follow these steps before opening a new issue.

## TOC

- [Installation problems](#installation-problems)
  - [404 downloading binding.node file](#404s)
- [Glossary](#glossary)
  - [Which node runtime am I using?](#which-node-runtime-am-i-using)
  - [Which version of node am I using?](#which-version-of-node-am-i-using)
  - [Debugging installation issues.](#debugging-installation-issues)
    - [Windows](#windows)
    - [Linux/OSX](#linuxosx)
- [Using node-sass with Visual Studio 2015 Task Runner.](#using-node-sass-with-visual-studio-2015-task-runner)
- [Installing node-sass 4.x with Node < 4](#installing-node-sass-4x-with-node--4)

## Installation

### 404s

If you see a 404 when trying to install node-sass, this indicates that you're trying
to install a version of node-sass that doesn't support your version of NodeJS, or
uses an alternate V8 environment (Meteor, Electron, etc...) that isn't supported
by node-sass.

```console
> node-sass@4.6.1 install /src/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releas…
Cannot download "https://github.com/sass/node-sass/releas…":

HTTP error 404 Not Found
```

If you encounter this, please check what version of NodeJs you're running (`node -v`)
and check for a supported version of node-sass for your NodeJs by checking our
[release page](https://github.com/sass/node-sass/releases).

### Proxy issues

If you work in behind a corporate proxy try setting the proxy variables. The
following is a [guide for setting this up](https://jjasonclark.com/how-to-setup-node-behind-web-proxy/).

### Running with sudo or as root

This can happen if you are install node-sass as `root`, or globally with `sudo`.
This is a security feature of `npm`. You should always avoid running `npm` as
`sudo` because install scripts can be unintentionally malicious.
Please check [npm documentation on fixing permissions](https://docs.npmjs.com/getting-started/fixing-npm-permissions).

If you must however, you can work around this error by using the `--unsafe-perm`
flag with npm install i.e.

```sh
sudo npm install --unsafe-perm -g node-sass
```

If this didn't solve your problem please open an issue with the output from
[our debugging script](#debugging-installation-issues).

### npm

Some users upgrading from previous versions of npm before 5 have found conflicts with
old lock file formats. This may be show up as a URL instead of the actual version
number when downloading the binary. EX:

```console
Downloading binary from https://github.com/sass/node-sass/releases/download/vhttps://registry.npmjs.org/node-sass/-/node-sass-4.5.3.tgz/win32-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/vhttps://registry.npmjs.org/node-sass/-/node-sass-4.5.3.tgz/win32-x64-57_binding.node":

HTTP error 404 Not Found
```

The easiest way to get around this is just to cleanup the npm files and reinstall.

```console
rm -rf node_modules
rm package-lock.json
npm cache clean
npm install
```

## Helping us, help you

### Find what version of Node you're running

To determine which version of Node.js or io.js you are currently using run the
following command in a terminal.

```console
node -v
```

The resulting value the version you are running.

### Debugging installation issues

Node sass runs some install scripts to make it as easy to use as possible, but
some times there can be issues. Before opening a new issue please follow the
instructions for [Windows](#windows) or [Linux/OSX](#linuxosx) and provide
their output in you [GitHub issue](https://github.com/sass/node-sass/issues).

**Remember to always search before opening a new issue**.

#### Windows

Firstly create a clean work space.

```console
mkdir \temp1
cd \temp1
```

Check your `COMSPEC` environment variable.

```console
node -p process.env.comspec
```

Please make sure the variable points to `C:\WINDOWS\System32\cmd.exe`

Gather some basic diagnostic information.

```console
npm -v
node -v
node -p process.versions
node -p process.platform
node -p process.arch
```

Clean npm cache

```console
npm cache clean
```

Install the latest node-sass

```console
npm install node-sass@latest
```

Note which version was installed by running

```console
npm ls node-sass
```

```console
y@1.0.0 /tmp
└── node-sass@3.8.0
```

If node-sass couldn't be installed successfully, please publish your `npm.log`
and `npm.err` files for analysis.

You can [download reference known-good logfiles](https://gist.github.com/saper/62b6e5ea41695c1883e3)
to compare your log against.

If node-sass install successfully lets gather some basic installation information.

```console
node -p "require('node-sass').info"
```

```console
node-sass       3.8.0   (Wrapper)       [JavaScript]
libsass         3.3.6   (Sass Compiler) [C/C++]
```

If the node-sass installation process produced an error, open the vendor folder.

```console
cd node_modules\node-sass\vendor
```

Then, using the version number we gather at the beginning, go to `https://github.com/sass/node-sass/releases/tag/v<your-version>`.

There you should see a folder with same name as the one in the `vendor` folder.
Download the `binding.node` file from that folder and replace your own with it.

Test if that worked by gathering some basic installation information.

```console
node -p "require('node-sass').info"
```

```console
node-sass       3.8.0   (Wrapper)       [JavaScript]
libsass         3.3.6   (Sass Compiler) [C/C++]
```

If this still produces an error please open an issue with the output from these
steps.

#### Linux/OSX

Firstly create a clean work space.

```sh
mkdir ~/temp1
cd ~/temp1
```

Gather some basic diagnostic information.

```sh
npm -v
node -v
node -p process.versions
node -p process.platform
node -p process.arch
```

Install the latest node-sass

```sh
npm install node-sass@latest
```

Note which version was installed by running

```sh
npm ls node-sass
```

```sh
y@1.0.0 /tmp
└── node-sass@3.8.0
```

If node-sass install successfully lets gather some basic installation information.

```sh
node -p "require('node-sass').info"
```

```sh
node-sass       3.8.0   (Wrapper)       [JavaScript]
libsass         3.3.6   (Sass Compiler) [C/C++]
```

If the node-sass installation process produced an error, open the vendor folder.

```sh
cd node_modules/node-sass/vendor
```

Then, using the version number we gather at the beginning, go to `https://github.com/sass/node-sass/releases/tag/v<your-version>`.

There you should see a folder with same name as the one in the `vendor` folder.
Download the `binding.node` file from that folder and replace your own with it.

Test if that worked by gathering some basic installation information.

```sh
node -p "require('node-sass').info"
```

```sh
node-sass       3.8.0   (Wrapper)       [JavaScript]
libsass         3.3.6   (Sass Compiler) [C/C++]
```

If this still produces an error please open an issue with the output from these
steps.

### Using node-sass with Visual Studio 2015 Task Runner

If you are using node-sass with VS2015 Task Runner Explorer, you need to make
sure that the version of node.js is same as the one you installed node-sass
with. This is because for each node.js runtime modules version (`node -p process.versions.modules`)
, we have a separate build of native binary. See [#532](https://github.com/sass/node-sass/issues/532).

Alternatively, if you prefer using system-installed node.js (supposedly higher
version than one bundles with VS2015), you may want to point Visual Studio 2015
to use it for task runner jobs by [following the guidelines](http://blogs.msdn.com/b/webdev/archive/2015/03/19/customize-external-web-tools-in-visual-studio-2015.aspx).

### Installing node-sass 4.x with Node < 4

See the discussion in [this comment](https://github.com/sass/node-sass/issues/2100#issuecomment-334651235)
for a workaround. As of node-sass@v5 only Node 6 and above will be officially supported.