node-chakracore icon indicating copy to clipboard operation
node-chakracore copied to clipboard

npm install node-sass fails, so most react-based projects won't work

Open matthargett opened this issue 9 years ago • 4 comments

Version: output of node -v

Platform: output of uname -a (UNIX), or version and 32 or 64-bit (Windows)

Subsystem: if known, please specify affected core module name

If possible, please provide code that demonstrates the problem, keeping it as simple and free of external dependencies as you are able.

  • Version: 7.0.0-pre9
  • Platform: Windows 10.0.14936 64-bit on SurfaceBook and Windows 10.0.10586 on Surface Pro 3
  • Subsystem:

Try 'npm install node-sass', even doing 'npm install node-sass --msvs_version=2015' doesn't work within a VS2015 Tools Command prompt. The ultimate use case I have is to use node-chakracore with https://github.com/pivotal-cf/react-starter . I'm expecting 'npm install' and 'gulp' to "just work".

matthargett avatar Oct 23 '16 02:10 matthargett

Thanks @matthargett for reporting this. I did some investigation and found that npm install copies the binding.node from node-sass repository and it fails to see the entry points because binding.node was built using nodev8. So I tried building binding.node using node-chakracore

node build/script.js -f --nodedir=<path_to_node_chakracore_repo>

With above command, I got following linker error.

  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: static class v8::internal::Object * * __cdecl v8::HandleScope::CreateHandle(class v8::internal::Isolate *,class v8::internal::Object *)" (__imp_?CreateHandle@HandleScope@v8@@KAPAPAVObject@internal@2@PAVIsolate@42@PAV342@@Z) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: static class v8::internal::Object * * __cdecl v8::HandleScope::CreateHandle(class v8::internal::HeapObject *,class v8::internal::Object *)" (__imp_?CreateHandle@HandleScope@v8@@CAPAPAVObject@internal@2@PAVHeapObject@42@PAV342@@Z) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: static void __cdecl v8::V8::ToLocalEmpty(void)" (__imp_?ToLocalEmpty@V8@v8@@CAXXZ) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: static void __cdecl v8::V8::FromJustIsNothing(void)" (__imp_?FromJustIsNothing@V8@v8@@CAXXZ) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: static void __cdecl v8::V8::DisposeGlobal(class v8::internal::Object * *)" (__imp_?DisposeGlobal@V8@v8@@CAXPAPAVObject@internal@2@@Z) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: static class v8::internal::Object * * __cdecl v8::V8::GlobalizeReference(class v8::internal::Isolate *,class v8::internal::Object * *)" (__imp_?GlobalizeReference@V8@v8@@CAPAPAVObject@internal@2@PAVIsolate@42@PAPAV342@@Z) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: class v8::internal::Object * * __thiscall v8::EscapableHandleScope::Escape(class v8::internal::Object * *)" (__imp_?Escape@EscapableHandleScope@v8@@AAEPAPAVObject@internal@2@PAPAV342@@Z) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: void * __thiscall v8::Object::SlowGetAlignedPointerFromInternalField(int)" (__imp_?SlowGetAlignedPointerFromInternalField@Object@v8@@AAEPAXH@Z) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: class v8::Local<class v8::Value> __thiscall v8::Object::SlowGetInternalField(int)" (__imp_?SlowGetInternalField@Object@v8@@AAE?AV?$Local@VValue@v8@@@2@H@Z) [e:\git\node-sass\build\binding.vcxproj]
  binding.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class v8::Local<class v8::ObjectTemplate> __cdecl v8::ObjectTemplate::New(class v8::Isolate *,class v8::Local<class v8::FunctionTemplate>)" (__imp_?New@ObjectTemplate@v8@@SA?AV?$Local@VObjectTemplate@v8@@@2@PAVIsolate@2@V?$Local@VFunctionTemplate@v8@@@2@@Z) [e:\git\node-sass\build\binding.vcxproj]
  create_string.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: bool __thiscall v8::Value::QuickIsString(void)const " (__imp_?QuickIsString@Value@v8@@ABE_NXZ) [e:\git\node-sass\build\binding.vcxproj]
  create_string.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: bool __thiscall v8::Value::QuickIsNull(void)const " (__imp_?QuickIsNull@Value@v8@@ABE_NXZ) [e:\git\node-sass\build\binding.vcxproj]
  custom_importer_bridge.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: bool __thiscall v8::Value::QuickIsUndefined(void)const " (__imp_?QuickIsUndefined@Value@v8@@ABE_NXZ) [e:\git\node-sass\build\binding.vcxproj]
  color.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class v8::Local<class v8::Signature> __cdecl v8::Signature::New(class v8::Isolate *,class v8::Local<class v8::FunctionTemplate>)" (__imp_?New@Signature@v8@@SA?AV?$Local@VSignature@v8@@@2@PAVIsolate@2@V?$Local@VFunctionTemplate@v8@@@2@@Z) [e:\git\node-sass\build\binding.vcxproj]

I tracked and these APIs are used by nan. Once we implement these APIs in chakrashim we should get past building binding.node with node-chakracore. I will update you once I fix these linker errors.

kunalspathak avatar Oct 27 '16 01:10 kunalspathak

@matthargett , I have opened an issue https://github.com/sass/node-sass/issues/1776 and a PR https://github.com/sass/node-sass/issues/1777 to address this. Issue is a long term solution, but if the PR is merged, you will be able to run npm install from Node.js chakracore command prompt which will install the module. I tried it on windows and ran unit test and they all pass.

kunalspathak avatar Oct 29 '16 07:10 kunalspathak

Once you manually install node-sass with the fix, does the react-starter project referenced above 'npm install' complete? Or is there another issue underneath the node-sass one?

matthargett avatar Nov 01 '16 01:11 matthargett

Yes, tried out react-starter and the unit test for it passes. In integration test, i can see browser opening and adding a TODO item and browser closes. But it exits with SIGUSR2. I verified and it fails for nodev8 as well, so something to do with Windows.

[email protected] E:\git\react-starter
`-- [email protected]
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  |   `-- [email protected]
  |     `-- [email protected]
  +-- [email protected]
  `-- [email protected]

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN You are using a pre-release version of node and things may not work as expected


E:\git\react-starter>gulp spec-app
[14:36:25] Using gulpfile E:\git\react-starter\gulpfile.js
[14:36:25] Starting 'spec-app'...
[14:36:30] Jasmine server listening on port 8000
.........................
25 specs, 0 failures
Finished in 0.2 seconds
[14:36:35] Finished 'spec-app' after 9.77 s

E:\git\react-starter>gulp spec-integration
[14:36:48] Using gulpfile E:\git\react-starter\gulpfile.js
[14:36:48] Starting 'spec-integration'...
[14:36:48] Starting 'clean-assets'...
[14:36:48] Finished 'clean-assets' after 8.1 ms
[14:36:48] Starting 'assets'...
[14:36:52] Version: webpack 1.13.3
              Asset       Size  Chunks             Chunk Names
         index.html    1.31 kB          [emitted]
     application.js    1.15 MB       0  [emitted]  application
    application.css  102 bytes       0  [emitted]  application
 application.js.map    1.37 MB       0  [emitted]  application
application.css.map   92 bytes       0  [emitted]  application
Child extract-text-webpack-plugin:

[14:36:52] Finished 'assets' after 4.01 s
[14:36:52] Starting 'server'...
[14:36:52] Finished 'server' after 5.68 ms
[14:36:52] Starting 'wait-for-server'...
spawned cluster, kill -s SIGUSR2 25740 to reload
[14:36:54] Finished 'wait-for-server' after 1.56 s
[14:36:54] Starting 'jasmine-integration'...
.
1 spec, 0 failures
Finished in 9.7 seconds
[14:37:04] Finished 'jasmine-integration' after 11 s
[14:37:04] Finished 'spec-integration' after 16 s
Error: Unknown signal: SIGUSR2
   at ChildProcess.prototype.kill (internal/child_process.js:375:5)
   at restartServer (E:\git\react-starter\tasks\server.js:13:13)
   at emitOne (events.js:101:7)
   at emit (events.js:188:7)
   at processEmit (E:\git\react-starter\node_modules\npm\node_modules\npmlog\node_modules\gauge\node_modules\signal-exit\index.js:140:5)
   at processEmit (E:\git\react-starter\node_modules\npm\node_modules\npm-registry-client\node_modules\npmlog\node_modules\gauge\node_modules\signal-exit\index.js:140:5)

E:\git\react-starter>node -pe process.jsEngine
chakracore

kunalspathak avatar Nov 01 '16 21:11 kunalspathak