nwjs / nw-gyp

native addon build tool for node-webkit
MIT License
195 stars 50 forks source link

Need help to build node-sass on Windows 7 #63

Closed JigneshRaval closed 9 years ago

JigneshRaval commented 9 years ago

Hello Sir,

I am new in node.js and node-webkit development. Currently I am trying to build one small application like jsfiddle or codepen which compiles my CSS, HTML and JS code and gives output in iframe. for that I want to include support of SASS using node-sass v2.0.0 or newer.

but I am facing in using node-sass (v2.0.0 or 2.0.1) in node-webkit version 0.12.0 Alpha 3 ( 64 bit). I need you help to resolve this issue. I tried everything that I found on internet but not getting any idea how to fix it.

Below is the configuration I am using.


OS : Windows 7 Ultimate 64 bit
Node.js : 0.12.0
nw-gyp : 0.12.4
node-webkit : 0.12.0-alpha3
Visual Studio : 2012 Express

When I am issuing following command in cmd then it works well


E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass>nw-gyp co
nfigure --target=0.12.0-alpha3 --ms-version=2012

gyp info it worked if it ends with ok
gyp info using nw-gyp@0.12.4
gyp info using node@0.12.0 | win32 | x64
child_process: customFds option is deprecated, use stdio instead.
gyp info spawn python
gyp info spawn args [ 'E:\\MySoftwares\\node.js\\node_modules\\nw-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:\\MySoftwares\\Node-Webkit-Developement\\Temp--\\nw-node-sass-testing\\node
_modules\\node-sass\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\MySoftwares\\node.js\\node_modules\\nw-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\cognellica\\.nw-gyp\\0.12.0-alpha3\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\cognellica\\.nw-gyp\\0.12.0-alpha3',
gyp info spawn args   '-Dmodule_root_dir=E:\\MySoftwares\\Node-Webkit-Developement\\Temp--\\nw-node-
sass-testing\\node_modules\\node-sass',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'E:\\MySoftwares\\Node-Webkit-Developement\\Temp--\\nw-node-sass-testing\\node
_modules\\node-sass\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok

But after that when I run nw-gyp build it throws various errors as listed below.


ent\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
cl : Command line warning D9025: overriding '/GR-' with '/GR' [E:\MySoftwares\Node-Webkit-Developem
ent\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
  sass_context_wrapper.cpp
  binding.cpp
  contextualize.cpp
  copy_c_str.cpp
  json.cpp
..\src\libsass\json.cpp(132): warning C4267: 'argument' : conversion from 'size_t' to 'int', possib
le loss of data [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\n
ode-sass\build\binding.vcxproj]
  extend.cpp
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\utility(182): warning C4267: 'initia
lizing' : conversion from 'size_t' to 'const unsigned int', possible loss of data (..\src\libsass\e
xtend.cpp) [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-s
ass\build\binding.vcxproj]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(617) : see refere
  nce to function template instantiation 'std::pair<_Ty1,_Ty2>::pair(std::pair &&,void **)' being compiled
          with
          [
              _Ty1=const unsigned int,
              _Ty2=Sass::Complex_Selector
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(617) : see refere
  nce to function template instantiation 'std::pair<_Ty1,_Ty2>::pair(std::pair &&,void **)' being compiled
          with
          [
              _Ty1=const unsigned int,
              _Ty2=Sass::Complex_Selector
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(751) : see refere
  nce to function template instantiation 'void std::allocator<_Ty>::construct<_Objty,std::pair<_Ty1
  ,_Ty2>>(_Objty *,_V0_t &&)' being compiled
          with
          [
              _Ty=std::_Tree_node,void *>,
              _Objty=std::pair,
              _Ty1=unsigned __int64,
              _Ty2=Sass::Complex_Selector,
              _V0_t=std::pair
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(751) : see refere
  nce to function template instantiation 'void std::allocator<_Ty>::construct<_Objty,std::pair<_Ty1
  ,_Ty2>>(_Objty *,_V0_t &&)' being compiled
          with
          [
              _Ty=std::_Tree_node,void *>,
              _Objty=std::pair,
              _Ty1=unsigned __int64,
              _Ty2=Sass::Complex_Selector,
              _V0_t=std::pair
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(903) : see refere
  nce to function template instantiation 'void std::allocator_traits<_Alloc>::construct<_Ty,std::pa
  ir<_Ty1,_Ty2>>(std::allocator<_Other> &,_Objty *,_V0_t &&)' being compiled
          with
          [
              _Alloc=std::allocator,void *>>,
              _Ty=std::pair,
              _Ty1=unsigned __int64,
              _Ty2=Sass::Complex_Selector,
              _Other=std::_Tree_node,void *>,
              _Objty=std::pair,
              _V0_t=std::pair
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0(903) : see refere
  nce to function template instantiation 'void std::allocator_traits<_Alloc>::construct<_Ty,std::pa
  ir<_Ty1,_Ty2>>(std::allocator<_Other> &,_Objty *,_V0_t &&)' being compiled
          with
          [
              _Alloc=std::allocator,void *>>,
              _Ty=std::pair,
              _Ty1=unsigned __int64,
              _Ty2=Sass::Complex_Selector,
              _Other=std::_Tree_node,void *>,
              _Objty=std::pair,
              _V0_t=std::pair
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtree(945) : see reference
   to function template instantiation 'void std::_Wrap_alloc<_Alloc>::construct<_Ty,std::pair<_Ty1,
  _Ty2>>(_Ty *,_V0_t &&)' being compiled
          with
          [
              _Alloc=std::allocator,void *>>,
              _Ty=std::pair,
              _Ty1=unsigned __int64,
              _Ty2=Sass::Complex_Selector,
              _V0_t=std::pair
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtree(945) : see reference
   to function template instantiation 'void std::_Wrap_alloc<_Alloc>::construct<_Ty,std::pair<_Ty1,
  _Ty2>>(_Ty *,_V0_t &&)' being compiled
          with
          [
              _Alloc=std::allocator,void *>>,
              _Ty=std::pair,
              _Ty1=unsigned __int64,
              _Ty2=Sass::Complex_Selector,
              _V0_t=std::pair
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtree(1151) : see referenc
  e to function template instantiation 'std::_Tree_node<_Value_type,_Voidptr> *std::_Tree_buy<_Ty,_
  Alloc>::_Buynode>(_V0_t &&)' being compiled
          with
          [
              _Value_type=std::pair,
              _Voidptr=void *,
              _Ty=std::pair,
              _Alloc=std::allocator>,
              _Ty1=unsigned __int64,
              _Ty2=Sass::Complex_Selector,
              _V0_t=std::pair
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtree(1151) : see referenc
  e to function template instantiation 'std::_Tree_node<_Value_type,_Voidptr> *std::_Tree_buy<_Ty,_
  Alloc>::_Buynode>(_V0_t &&)' being compiled
          with
          [
              _Value_type=std::pair,
              _Voidptr=void *,
              _Ty=std::pair,
              _Alloc=std::allocator>,
              _Ty1=unsigned __int64,
              _Ty2=Sass::Complex_Selector,
              _V0_t=std::pair
          ]
          e:\mysoftwares\node-webkit-developement\temp--\nw-node-sass-testing\node_modules\node-sas
  s\src\libsass\sass_util.hpp(237) : see reference to function template instantiation 'std::pair<_T
  y1,_Ty2> std::_Tree<_Traits>::insert>(_Valty &
  &)' being compiled
          with
          [
              _Ty1=std::_Tree_iterator>>>,
              _Ty2=bool,
              _Traits=std::_Tmap_traits
  ,std::allocator>,false>,
              _Valty=std::pair
          ]
          e:\mysoftwares\node-webkit-developement\temp--\nw-node-sass-testing\node_modules\node-sas
  s\src\libsass\sass_util.hpp(237) : see reference to function template instantiation 'std::pair<_T
  y1,_Ty2> std::_Tree<_Traits>::insert>(_Valty &
  &)' being compiled
          with
          [
              _Ty1=std::_Tree_iterator>>>,
              _Ty2=bool,
              _Traits=std::_Tmap_traits
  ,std::allocator>,false>,
              _Valty=std::pair
          ]
          ..\src\libsass\extend.cpp(1505) : see reference to function template instantiation 'void
  Sass::group_by_to_a>(std::vector<_Ty> &
  ,KeyFunctorType &,std::vector> &)' being compiled
          with
          [
              V=std::pair,
              KeyType=Sass::Complex_Selector,
              _Ty=std::pair,
              KeyFunctorType=Sass::GroupByToAFunctor,
              _Ty1=Sass::Complex_Selector,
              _Ty2=std::vector>
          ]
  output_nested.cpp
  sass_util.cpp
  constants.cpp
  context.cpp
  sass.cpp
  base64vlq.cpp
  source_map.cpp
  expand.cpp
  file.cpp
  node.cpp
  bind.cpp
  parser.cpp
  ast.cpp
..\src\binding.cpp(172): error C2664: 'GetResult' : cannot convert parameter 1 from 'v8::Persistent
' to 'v8::Handle' [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_m
odules\node-sass\build\binding.vcxproj]
          with
          [
              T=v8::Object
          ]
          No user-defined-conversion operator available that can perform this conversion, or the op
  erator cannot be called
..\src\binding.cpp(223): error C2664: 'GetResult' : cannot convert parameter 1 from 'v8::Persistent
' to 'v8::Handle' [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_m
odules\node-sass\build\binding.vcxproj]
          with
          [
              T=v8::Object
          ]
          No user-defined-conversion operator available that can perform this conversion, or the op
  erator cannot be called
..\src\binding.cpp(270): error C2664: 'GetResult' : cannot convert parameter 1 from 'v8::Persistent
' to 'v8::Handle' [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_m
odules\node-sass\build\binding.vcxproj]
          with
          [
              T=v8::Object
          ]
          No user-defined-conversion operator available that can perform this conversion, or the op
  erator cannot be called
..\src\binding.cpp(308): warning C4267: 'argument' : conversion from 'size_t' to 'uint32_t', possib
le loss of data [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\n
ode-sass\build\binding.vcxproj]
..\src\binding.cpp(314): error C2039: 'New' : is not a member of 'v8::String' [E:\MySoftwares\Node-
Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
          C:\Users\cognellica\.nw-gyp\0.12.0-alpha3\deps\v8\include\v8.h(1885) : see declaration of
   'v8::String'
..\src\binding.cpp(314): error C3861: 'New': identifier not found [E:\MySoftwares\Node-Webkit-Devel
opement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
..\src\binding.cpp(315): error C2039: 'New' : is not a member of 'v8::String' [E:\MySoftwares\Node-
Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
          C:\Users\cognellica\.nw-gyp\0.12.0-alpha3\deps\v8\include\v8.h(1885) : see declaration of
   'v8::String'
..\src\binding.cpp(315): error C3861: 'New': identifier not found [E:\MySoftwares\Node-Webkit-Devel
opement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
..\src\binding.cpp(323): error C2039: 'New' : is not a member of 'v8::String' [E:\MySoftwares\Node-
Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
          C:\Users\cognellica\.nw-gyp\0.12.0-alpha3\deps\v8\include\v8.h(1885) : see declaration of
   'v8::String'
..\src\binding.cpp(323): error C3861: 'New': identifier not found [E:\MySoftwares\Node-Webkit-Devel
opement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
..\src\binding.cpp(324): error C2039: 'New' : is not a member of 'v8::String' [E:\MySoftwares\Node-
Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
          C:\Users\cognellica\.nw-gyp\0.12.0-alpha3\deps\v8\include\v8.h(1885) : see declaration of
   'v8::String'
..\src\binding.cpp(324): error C3861: 'New': identifier not found [E:\MySoftwares\Node-Webkit-Devel
opement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
  util.cpp
  eval.cpp
  sass2scss.cpp
  error_handling.cpp
  sass_values.cpp
  sass_context.cpp
  functions.cpp
  output_compressed.cpp
..\src\libsass\sass_context.cpp(180): warning C4297: 'copy_strings' : function assumed not to throw
 an exception but does [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_mo
dules\node-sass\build\binding.vcxproj]
          The function is extern "C" and /EHc was specified
..\src\libsass\sass_context.cpp(184): warning C4297: 'copy_strings' : function assumed not to throw
 an exception but does [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_mo
dules\node-sass\build\binding.vcxproj]
          The function is extern "C" and /EHc was specified
..\src\libsass\sass_context.cpp(388): warning C4267: 'argument' : conversion from 'size_t' to 'int'
, possible loss of data [E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_m
odules\node-sass\build\binding.vcxproj]
  to_c.cpp
..\src\libsass\output_compressed.cpp(261): error C3861: 'round': identifier not found [E:\MySoftwar
es\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxpro
j]
..\src\libsass\output_compressed.cpp(262): error C3861: 'round': identifier not found [E:\MySoftwar
es\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxpro
j]
..\src\libsass\output_compressed.cpp(263): error C3861: 'round': identifier not found [E:\MySoftwar
es\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxpro
j]
  utf8_string.cpp
  inspect.cpp
..\src\libsass\functions.cpp(1068): error C3861: 'trunc': identifier not found [E:\MySoftwares\Node
-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
..\src\libsass\functions.cpp(1077): error C3861: 'trunc': identifier not found [E:\MySoftwares\Node
-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
  sass_functions.cpp
..\src\libsass\inspect.cpp(399): error C3861: 'round': identifier not found [E:\MySoftwares\Node-We
bkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
..\src\libsass\inspect.cpp(400): error C3861: 'round': identifier not found [E:\MySoftwares\Node-We
bkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
..\src\libsass\inspect.cpp(401): error C3861: 'round': identifier not found [E:\MySoftwares\Node-We
bkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass\build\binding.vcxproj]
  remove_placeholders.cpp
  to_string.cpp
  units.cpp
  prelexer.cpp
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit c
ode: 1
gyp ERR! stack     at ChildProcess.onExit (E:\MySoftwares\node.js\node_modules\nw-gyp\lib\build.js:2
67:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "E:\\MySoftwares\\node.js\\\\node.exe" "E:\\MySoftwares\\node.js\\node_modules\\nw-
gyp\\bin\\nw-gyp.js" "build"
gyp ERR! cwd E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-s
ass
gyp ERR! node -v v0.12.0
gyp ERR! nw-gyp -v v0.12.4
gyp ERR! not ok

E:\MySoftwares\Node-Webkit-Developement\Temp--\nw-node-sass-testing\node_modules\node-sass>

Please guide me how can I resolve this issue.

Thank you,

ghostoy commented 9 years ago

From official node-sass docs:

Compiling versions 0.9.4 and above on Windows machines requires Visual Studio 2013 WD. If you have multiple VS versions, use npm install with the --msvs_version=2013 flag also use this flag when rebuilding the module with node-gyp or nw-gyp.

JigneshRaval commented 9 years ago

Hi Cong Liu,

I am really thankful for your reply and I am sorry about forgetting to mention that after installing Visual Studio 2013 my issue has been resolved.

But I would like to ask one question that why we need this much heavy software just for compiling and getting binding.node file.

Could you please guide about any other easy or less complicated way which can be easily implement without requiring such a heavy and proprietary software like Visual Studio 2013 which installs so many things like Silverlight, F#, C#, ASP.net, SQL Server and many things. I think which are not require in building node-sass or any other like node-sass.

I mean it is possible to use any Freeware C/C++ IDE with compiler dependency like C++ Run-time 2013, .net Framework 4.5 or any particular components or redistributables?

Please guide me on this because your guidance will be helpful to understand the process behind this.

Thanks & Regards, Jignesh Raval

Kaskarl commented 9 years ago

can you help me?

https://github.com/nwjs/nw-gyp/issues/64

JigneshRaval commented 9 years ago

Hi Cong Liu,

I hope this will be helpfull. Today I have got this.

MSBuild Engine is now Open Source on GitHub.

http://blogs.msdn.com/b/dotnet/archive/2015/03/18/msbuild-engine-is-now-open-source-on-github.aspx

Here is a brief description: MSBuild Visual Studio 2013 Other Versions

The Microsoft Build Engine is a platform for building applications. This engine, which is also known as MSBuild, provides an XML schema for a project file that controls how the build platform processes and builds software. Visual Studio uses MSBuild, but it doesn't depend on Visual Studio. By invoking msbuild.exe on your project or solution file, you can orchestrate and build products in environments where Visual Studio isn't installed.

Visual Studio uses MSBuild to load and build managed projects. The project files in Visual Studio (.csproj,.vbproj, vcxproj, and others) contain MSBuild XML code that executes when you build a project by using the IDE. Visual Studio projects import all the necessary settings and build processes to do typical development work, but you can extend or modify them from within Visual Studio or by using an XML editor.

For information about MSBuild for C++, see MSBuild (Visual C++).

The following examples illustrate when you might run builds by using an MSBuild command line instead of the Visual Studio IDE.

Visual Studio isn't installed.

You want to use the 64-bit version of MSBuild. This version of MSBuild is usually unnecessary, but it allows MSBuild to access more memory.

You want to run a build in multiple processes. However, you can use the IDE to achieve the same result on projects in C++ and C#.

You want to modify the build system. For example, you might want to enable the following actions:

    Preprocess files before they reach the compiler.

    Copy the build outputs to a different place.

    Create compressed files from build outputs.

    Do a post-processing step. For example, you might want to stamp an assembly with a different version.

You can write code in the Visual Studio IDE but run builds by using MSBuild. As another alternative, you can build code in the IDE on a development computer but use an MSBuild command line to build code that's integrated from multiple developers.

ghostoy commented 9 years ago

@JigneshRaval Noted. Thank you for providing another alternative. However VS is currently the official way to work with nw-gyp.

ghostoy commented 9 years ago

For further questions about nw.js, please refer to Gitter or Mailing list.