7

I'm following a tutorial, nothing fancy. I'm trying to add node-sass and sass-loader via yarn add .

The command I run (I also tried the latest versions available) :

yarn add sass-loader@6.0.6 node-sass@4.5.3

This fails, and this is the output:

yarn add v1.9.2
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["colors@latest"] is trying to unpack in the same destination "C
:\\Users\\sagil\\AppData\\Local\\Yarn\\Cache\\v1\\npm-colors-1.1.2-168a4701756b6
a7f51a12ce0c97bfa28c084ed63" as pattern ["colors@~1.1.2"]. This could result in
non-deterministic behavior, skipping.
warning Pattern ["object-assign@latest"] is trying to unpack in the same destina
tion "C:\\Users\\sagil\\AppData\\Local\\Yarn\\Cache\\v1\\npm-object-assign-4.1.1
-2109adc7965887cfc05cbbd442cac8bfbb360863" as pattern ["object-assign@^4.1.0","o
bject-assign@^4.1.0","object-assign@^4.0.1","object-assign@^4.0.1","object-assig
n@^4.0.1","object-assign@^4.0.1","object-assign@^4.1.0","object-assign@^4","obje
ct-assign@^4.1.1","object-assign@^4.1.0","object-assign@^4.1.1","object-assign@^
4.1.1","object-assign@^4.0.1","object-assign@^4.0.1","object-assign@^4.0.1","obj
ect-assign@^4.0.1","object-assign@^4.0.1"]. This could result in non-determinist
ic behavior, skipping.
info fsevents@1.1.2: The platform "win32" is incompatible with this module.
info "fsevents@1.1.2" is an optional dependency and failed compatibility check.
Excluding it from installation.
[3/4] Linking dependencies...
warning " > react-modal@2.2.2" has incorrect peer dependency "react@^0.14.0 || ^
15.0.0".
warning " > react-modal@2.2.2" has incorrect peer dependency "react-dom@^0.14.0
|| ^15.0.0".
[4/4] Building fresh packages...
[-/2] ? waiting...
error C:\Users\sagil\Desktop\ReactTutorial\indecision-app\node_modules\node-sass
: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: C:\Users\sagil\Desktop\ReactTutorial\indecision-app\node_modules\node
-sass
Output:
Building: C:\Program Files\nodejs\node.exe C:\Users\sagil\Desktop\ReactTutorial\
indecision-app\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass
_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\sagil\\Desktop\\ReactTutorial\\indecision-app\\node_m
odules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.8.0
gyp info using node@10.7.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\sagil\Desktop\ReactTut
orial\indecision-app\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\sagil\Desktop\ReactTutorial\indecisio
n-app\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\sagil\Desktop\ReactTutorial\indecisio
n-app\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:158:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\sagil\Desktop\ReactTut
orial\indecision-app\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\sagil\Desktop\ReactTutorial\indecisio
n-app\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\sagil\Desktop\ReactTutorial\indecisio
n-app\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:158:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python2\n    at getNotFoundError (
C:\\Users\\sagil\\Desktop\\ReactTutorial\\indecision-app\\node_modules\\which\\w
hich.js:13:12)\n    at F (C:\\Users\\sagil\\Desktop\\ReactTutorial\\indecision-a
pp\\node_modules\\which\\which.js:68:19)\n    at E (C:\\Users\\sagil\\Desktop\\R
eactTutorial\\indecision-app\\node_modules\\which\\which.js:80:29)\n    at C:\\U
sers\\sagil\\Desktop\\ReactTutorial\\indecision-app\\node_modules\\which\\which.
js:89:16\n    at C:\\Users\\sagil\\Desktop\\ReactTutorial\\indecision-app\\node_
modules\\isexe\\index.js:42:5\n    at C:\\Users\\sagil\\Desktop\\ReactTutorial\\
indecision-app\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplet
e (fs.js:158:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\Users\sagil\Desktop\ReactTut
orial\indecision-app\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\sagil\Desktop\ReactTutorial\indecisio
n-app\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\sagil\Desktop\ReactTutorial\indecisio
n-app\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:158:21)
gyp verb `which` failed  python { Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\Users\sagil\Desktop\ReactTut
orial\indecision-app\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\sagil\Desktop\ReactTutorial\indecisio
n-app\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\sagil\Desktop\ReactTutorial\indecisio
n-app\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\sagil\Desktop\ReactTutorial\indecision-a
pp\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:158:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python\n    at getNotFoundError (C
:\\Users\\sagil\\Desktop\\ReactTutorial\\indecision-app\\node_modules\\which\\wh
ich.js:13:12)\n    at F (C:\\Users\\sagil\\Desktop\\ReactTutorial\\indecision-ap
p\\node_modules\\which\\which.js:68:19)\n    at E (C:\\Users\\sagil\\Desktop\\Re
actTutorial\\indecision-app\\node_modules\\which\\which.js:80:29)\n    at C:\\Us
ers\\sagil\\Desktop\\ReactTutorial\\indecision-app\\node_modules\\which\\which.j
s:89:16\n    at C:\\Users\\sagil\\Desktop\\ReactTutorial\\indecision-app\\node_m
odules\\isexe\\index.js:42:5\n    at C:\\Users\\sagil\\Desktop\\ReactTutorial\\i
ndecision-app\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete
 (fs.js:158:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\sagil\Desktop\ReactTut
orial\indecision-app\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\sagil\Desktop\ReactTuto
rial\indecision-app\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at C:\Users\sagil\Desktop\ReactTutorial\indecision-app\node_m
odules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\sagil\\Deskto
p\\ReactTutorial\\indecision-app\\node_modules\\node-gyp\\bin\\node-gyp.js" "reb
uild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--l
ibsass_library="
gyp ERR! cwd C:\Users\sagil\Desktop\ReactTutorial\indecision-app\node_modules\no
de-sass
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this comm

why is this happening?

Dave Carruthers
  • 502
  • 1
  • 7
  • 25
  • If you are behind proxy or have some internet related issue you can try offline method where you can download node-sass binding file and tell your .yarnrc to use file from there. More at https://stackoverflow.com/questions/45424094/how-to-get-yarn-install-offline-with-node-sass-working – Lokesh Daiya Oct 12 '18 at 07:15
  • looks like you don't have `windows-build-tools`. try installing it from [here](https://www.npmjs.com/package/windows-build-tools) – Sonu Bamniya Nov 27 '19 at 07:19
  • Please check nodejs version and node-sass version. Node js's version must compatible node-sass's version – Ramil Aliyev Feb 10 '20 at 09:01

2 Answers2

4

It is because of your node version is not matching with the compatibility of node-sass. Please refer node-sass -npm read.me page

4

after a yarn install cmd

got ERROR : /node_modules/node-sass: Command failed

this because you have some unmatched versions between nodeJs and node-sass if your node version is v12 or upper go to package.json and update your node-sass version to 4.12.0 :

{ 
...
"node-sass": "4.12.0",
...
}

src : link to docs

ZINE Mahmoud
  • 1,116
  • 1
  • 11
  • 28