node-sass: Install node-sass 4.5.0 failed on window 7, "Binary has a problem: Error: %1 is not a valid Win32 application.".

After update dependencies in package.json, run “npm install” failed when installing node-sass. I tried a few times, it seems download ‘win32-x64-48_binding.node’ always failed.

My node registry is set to cnpm ‘http://r.cnpmjs.org/’, does it influence the installation? But I can installed node-sass successfully few weeks ago when I didn’t update dependencies .

Here is my dependencies in package.json.

  "dependencies": {
    "isomorphic-fetch": "^2.2.1",
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "react-redux": "^5.0.2",
    "react-router-redux": "^4.0.7",
    "redux": "^3.6.0",
    "redux-logger": "^2.8.1",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "babel-core": "^6.22.1",
    "babel-loader": "^6.2.10",
    "babel-preset-es2015": "^6.22.0",
    "babel-preset-react": "^6.22.0",
    "babel-preset-stage-0": "^6.22.0",
    "css-loader": "^0.26.1",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.10.0",
    "html-webpack-plugin": "^2.28.0",
    "node-sass": "^4.5.0",
    "react-router": "^3.0.2",
    "sass-loader": "^5.0.1",
    "style-loader": "^0.13.1",
    "url-loader": "^0.5.7",
    "webpack": "^2.2.1",
    "webpack-dev-server": "^2.3.0"
  }

The error log.

E:\teach\myLearn>npm install node-sass
npm WARN deprecated lodash.assign@4.2.0: This package is deprecated. Use Object.
assign.
npm WARN prefer global node-gyp@3.5.0 should be installed with -g

> node-sass@4.5.0 install E:\teach\myLearn\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5
.0/win32-x64-48_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.0/win3
2-x64-48_binding.node":

ESOCKETTIMEDOUT

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@4.5.0 postinstall E:\teach\myLearn\node_modules\node-sass
> node scripts/build.js

Binary found at E:\teach\myLearn\node_modules\node-sass\vendor\win32-x64-48\bind
ing.node
Testing binary
Binary has a problem: Error: %1 is not a valid Win32 application.
\\?\E:\teach\myLearn\node_modules\node-sass\vendor\win32-x64-48\binding.node
    at Error (native)
    at Object.Module._extensions..node (module.js:583:18)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at module.exports (E:\teach\myLearn\node_modules\node-sass\lib\binding.js:19
:10)
    at Object.<anonymous> (E:\teach\myLearn\node_modules\node-sass\lib\index.js:
14:35)
    at Module._compile (module.js:556:32)
Building the binary locally
Building: C:\Program Files\nodejs\node.exe E:\teach\myLearn\node_modules\node-gy
p\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_l
dflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'E:\\teach\\myLearn\\node_modules\\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.5.0
gyp info using node@6.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 (E:\teach\myLearn\node_modules\w
hich\which.js:13:12)
gyp verb `which` failed     at F (E:\teach\myLearn\node_modules\which\which.js:6
8:19)
gyp verb `which` failed     at E (E:\teach\myLearn\node_modules\which\which.js:8
0:29)
gyp verb `which` failed     at E:\teach\myLearn\node_modules\which\which.js:89:1
6
gyp verb `which` failed     at E:\teach\myLearn\node_modules\isexe\index.js:44:5

gyp verb `which` failed     at E:\teach\myLearn\node_modules\isexe\windows.js:29
:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (E:\teach\myLearn\node_modules\w
hich\which.js:13:12)
gyp verb `which` failed     at F (E:\teach\myLearn\node_modules\which\which.js:6
8:19)
gyp verb `which` failed     at E (E:\teach\myLearn\node_modules\which\which.js:8
0:29)
gyp verb `which` failed     at E:\teach\myLearn\node_modules\which\which.js:89:1
6
gyp verb `which` failed     at E:\teach\myLearn\node_modules\isexe\index.js:44:5

gyp verb `which` failed     at E:\teach\myLearn\node_modules\isexe\windows.js:29
:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOENT
' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\python27\python.EXE
gyp verb check python version `C:\python27\python.EXE -c "import platform; print
(platform.python_version());"` returned: "2.7.11\r\n"
gyp verb get node dir no --target version specified, falling back to host node v
ersion: 6.7.0
gyp verb command install [ '6.7.0' ]
gyp verb install input version string "6.7.0"
gyp verb install installing version: 6.7.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 6.7.0
gyp verb build dir attempting to create "build" dir: E:\teach\myLearn\node_modul
es\node-sass\build
gyp verb build dir "build" dir needed to be created? E:\teach\myLearn\node_modul
es\node-sass\build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: E:\teach\myLearn\node_module
s\node-sass\build\config.gypi
gyp verb config.gypi checking for gypi file: E:\teach\myLearn\node_modules\node-
sass\config.gypi
gyp verb common.gypi checking for gypi file: E:\teach\myLearn\node_modules\node-
sass\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\python27\python.EXE
gyp info spawn args [ 'E:\\teach\\myLearn\\node_modules\\node-gyp\\gyp\\gyp_main
.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\teach\\myLearn\\node_modules\\node-sass\\build\\confi
g.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\teach\\myLearn\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Administrator\\.node-gyp\\6.7.0\\include\\node
\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Administrator\\.node-gyp\\6.7.
0',
gyp info spawn args   '-Dnode_gyp_dir=E:\\teach\\myLearn\\node_modules\\node-gyp
',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=E:\\teach\\myLearn\\node_modules\\node-
sass',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'E:\\teach\\myLearn\\node_modules\\node-sass\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\Administrator\.node-gyp\6.7.0
gyp verb found first Solution file build/binding.sln
gyp verb could not find "msbuild.exe" in PATH - finding location in registry
gyp verb "Release" dir needed to be created? null
gyp verb copying "node.lib" for x64 C:\Users\Administrator\.node-gyp\6.7.0\Relea
se\node.lib
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
生成启动时间为 2017/2/9 16:53:05。
节点 1 上的项目“E:\teach\myLearn\node_modules\node-sass\build\binding.sln”(默
认目标)。
ValidateSolutionConfiguration:
  正在生成解决方案配置“Release|x64”。
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,
1) 安装 .NET Fram
ework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到了
其他位置,请将其位置添加到系统
路径中。 [E:\teach\myLearn\node_modules\node-sass\build\binding.sln]
已完成生成项目“E:\teach\myLearn\node_modules\node-sass\build\binding.sln”(默认
目标)的操作 - 失
败。


生成失败。

“E:\teach\myLearn\node_modules\node-sass\build\binding.sln”(默认目标) (1) ->
(_src_\libsass 目标) ->
  MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题
,1) 安装 .NET Fr
amework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到
了其他位置,请将其位置添加到
系统路径中。 [E:\teach\myLearn\node_modules\node-sass\build\binding.sln]

    0 个警告
    1 个错误

已用时间 00:00:00.05
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (E:\teach\myLearn\node_modules\node-gy
p\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:215:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\teach\\myLearn\\node
_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--
libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\teach\myLearn\node_modules\node-sass
gyp ERR! node -v v6.7.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fseve
nts@1.0.17
npm WARN extract-text-webpack-plugin@1.0.1 requires a peer of webpack@^1.9.11 bu
t none was installed.
npm WARN myLearn@1.0.0 No description
npm WARN myLearn@1.0.0 No repository field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "node-sass"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! node-sass@4.5.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.5.0 postinstall script 'node scripts/build.js
'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\teach\myLearn\npm-debug.log

When reporting an bug, you must provide this information:

  • NPM version (npm -v): 3.10.3
  • Node version (node -v): 6.7.0
  • Node Process (node -p process.versions): { http_parser: '2.7.0 node: ‘6.7.0’, v8: ‘5.1.281.83’, uv: ‘1.9.1’, zlib: ‘1.2.8’, ares: ‘1.10.1-DEV’, icu: ‘57.1’, modules: ‘48’, openssl: ‘1.0.2j’ }
  • Node Platform (node -p process.platform): win32
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"): module.js:583 return process.dlopen(module, path._makeLong(filename)); ^

Error: The process cannot access the file because it is being used by another pr ocess. \?\E:\teach\myLearn\node_modules\node-sass\vendor\win32-x64-48\binding.node at Error (native) at Object.Module._extensions…node (module.js:583:18) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at module.exports (E:\teach\myLearn\node_modules\node-sass\lib\binding.js:19 :10) at Object.<anonymous> (E:\teach\myLearn\node_modules\node-sass\lib\index.js: 14:35) at Module._compile (module.js:556:32)

  • npm node-sass versions (npm ls node-sass): myLearn@1.0.0 E:\teach\myLearn ±- node-sass@4.5.0 `-- UNMET PEER DEPENDENCY webpack@2.2.1

npm ERR! peer dep missing: webpack@^1.9.11, required by extract-text-webpack-plu gin@1.0.1

When encountering a syntax, or compilation issue:

If you delete this text without following it, your issue will be closed.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (4 by maintainers)

Commits related to this issue

Most upvoted comments

I have found a solution.

After installed failed, a node-sass\4.5.0 folder is still created in npm-cache folder. So I download win32-x64-48_binding.node manually, put it in C:\Users\Administrator\AppData\Roaming\npm-cache\node-sass\4.5.0 folder.

Then I can install node-sass successfully.

Ok here is what worked for me.

  1. Download the binary file and put into temp directory
  2. Set the sass binary path in CMD: SET SASS_BINARY_PATH=C:/temp/win32-x64-51_binding.node For bash/powershell (https://github.com/sass/node-sass/issues/1106#issuecomment-134559641)
  3. npm install node-sass

As work around run npm cache clean.

I had same issue for node-sass@4.5.3. Downloading win32-x64-48_binding.node manually and putting it in C:\Users\Administrator\AppData\Roaming\npm-cache\node-sass\4.5.3 folder fixed the issue.

@xzyfer yes done that, doesn’t work.

Seem to work in a clean directory though, so it looks like a dependency problem of some kind.

Edit: Manually downloading the binary and adding it from command line did it for me. I did:

  • Check error message for missing binary
> node-sass@3.6.0 install C:\Code\Coreweb\CoreInsats\Source\InsatsrapportWeb\node_modules\node-sass
> node scripts/install.js

Cannot download "https://github.com/sass/node-sass/releases/download/v3.6.0/win32-x64-48_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080
npm install node-sass --sass-binary-path="C:\\Users\\myuser\\Downloads\\win32-x64-48_binding.node"
  • Using env variable like above did not work for me, might be front slashes or some other windows issue

So it looks like the problem is that the install script expect the url above to work but it doesn’t. Probably removed since it’s a really old release? I still think it’s a problem since the error message is kind of hidden for the end user.

Delete your node_modules, clear your npm caches, and npm install

On 4 Jul. 2017 8:50 pm, “Daniel Sundberg” notifications@github.com wrote:

Why is this issue closed?

I just got this after trying to update my application from Node-4.2.2 to latest LTS. No idea how to solve this on a project with more than hundred dependencies.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sass/node-sass/issues/1888#issuecomment-312847552, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWLJvk9uRJ6QO8tKOFmkww4FyndoJks5sKhi0gaJpZM4L75BP .