0

我试图node-sass在我的 openshift 应用程序中运行。

npm 日志在推送/部署时显示:

remote: npm info install node-sass@2.0.0-beta
remote: 
remote: > node-sass@2.0.0-beta install /var/lib/openshift/54ab0e0bfcf93364160001fb/app-root/runtime/repo/node_modules/node-sass
remote: > node scripts/install.js
remote: 
remote: tunneling socket could not be established, cause=Parse Error
remote: tunneling socket could not be established, cause=Parse Error
remote: fs: missing callback Error: ENOENT, unlink '/var/lib/openshift/54ab0e0bfcf93364160001fb/app-root/runtime/repo/node_modules/node-sass/vendor/linux-x64/binding.node'
remote: npm info postinstall node-sass@2.0.0-beta
remote: 
remote: > node-sass@2.0.0-beta postinstall /var/lib/openshift/54ab0e0bfcf93364160001fb/app-root/runtime/repo/node_modules/node-sass
remote: > node scripts/build.js

部署后我得到这个日志:

DEBUG: Starting child process with 'coffee index.coffee'
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
  at getBinding (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass/lib/index.js:21:11)
  at Object.<anonymous> (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass/lib/index.js:211:23)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/routes/checkout.coffee:9:14)
  at Object.<anonymous> (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/routes/checkout.coffee:1:1)
  at Module._compile (module.js:456:26)
  at Object.loadFile (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
  at Module.load (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/routes/main.coffee:32:3)
  at Object.<anonymous> (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/routes/main.coffee:1:1)
  at Module._compile (module.js:456:26)
  at Object.loadFile (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
  at Module.load (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/index.coffee:5:17)
  at Object.<anonymous> (/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/index.coffee:1:1)
  at Module._compile (module.js:456:26)
DEBUG: Program coffee index.coffee exited with code 1

试图用谷歌搜索这些错误,但找不到任何真正的解决方案。

任何帮助表示赞赏!

编辑:

当我尝试将node-sass版本设置为 1.2.3 这是构建的输出

remote: npm info install node-sass@1.2.3
remote: 
remote: > node-sass@1.2.3 install /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass
remote: > node scripts/install.js
remote: 
remote: tunneling socket could not be established, cause=Parse Error
remote: tunneling socket could not be established, cause=Parse Error
remote: fs: missing callback Error: ENOENT, unlink '/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass/vendor/linux-x64/binding.node'
remote: npm info postinstall node-sass@1.2.3
remote: 
remote: > node-sass@1.2.3 postinstall /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass
remote: > node scripts/build.js
remote: 
remote: gyp info it worked if it ends with ok
remote: gyp info using node-gyp@0.12.2
remote: gyp info using node@0.10.25 | linux | x64
remote: gyp info spawn python
remote: gyp info spawn args [ '/opt/rh/v8314/root/usr/bin/gyp',
remote: gyp info spawn args   'binding.gyp',
remote: gyp info spawn args   '-f',
remote: gyp info spawn args   'make',
remote: gyp info spawn args   '-I',
remote: gyp info spawn args   '/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass/build/config.gypi',
remote: gyp info spawn args   '-I',
remote: gyp info spawn args   '/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/addon-rpm.gypi',
remote: gyp info spawn args   '-I',
remote: gyp info spawn args   '/opt/rh/nodejs010/root/usr/share/node/common.gypi',
remote: gyp info spawn args   '-Dlibrary=shared_library',
remote: gyp info spawn args   '-Dvisibility=default',
remote: gyp info spawn args   '-Dnode_root_dir=/opt/rh/nodejs010/root/usr/share/node',
remote: gyp info spawn args   '-Dmodule_root_dir=/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass',
remote: gyp info spawn args   '--depth=.',
remote: gyp info spawn args   '--generator-output',
remote: gyp info spawn args   'build',
remote: gyp info spawn args   '-Goutput_dir=.' ]
remote: gyp info spawn make
remote: gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
remote: make: Entering directory `/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass/build'
remote:   CXX(target) Release/obj.target/binding/src/binding.o
remote:   CXX(target) Release/obj.target/binding/src/sass_context_wrapper.o
remote:   CXX(target) Release/obj.target/binding/src/libsass/ast.o
remote: In file included from ../src/libsass/ast.cpp:1:
remote: ../src/libsass/ast.hpp: In constructor 'Sass::Hashed::Hashed(size_t)':
remote: ../src/libsass/ast.hpp:211: error: 'class std::unordered_map<Sass::Expression*, Sass::Expression*, std::hash<Sass::Expression*>, std::equal_to<Sass::Expression*>, std::allocator<std::pair<Sass::Expression* const, Sass::Expression*> > >' has no member named 'reserve'
remote: ../src/libsass/ast.hpp: In member function 'Sass::Hashed& Sass::Hashed::operator+=(Sass::Hashed*)':
remote: ../src/libsass/ast.hpp:236: error: expected initializer before ':' token
remote: ../src/libsass/ast.hpp:239: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:239: error: expected ';' before 'return'
remote: ../src/libsass/ast.hpp:239: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:239: error: expected ')' before 'return'
remote: ../src/libsass/ast.hpp: In member function 'virtual bool Sass::Map::operator==(Sass::Expression&) const':
remote: ../src/libsass/ast.hpp:719: error: expected initializer before ':' token
remote: ../src/libsass/ast.hpp:721: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:721: error: expected ';' before 'return'
remote: ../src/libsass/ast.hpp:721: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:721: error: expected ')' before 'return'
remote: ../src/libsass/ast.hpp: In member function 'virtual size_t Sass::Map::hash()':
remote: ../src/libsass/ast.hpp:733: error: expected initializer before ':' token
remote: ../src/libsass/ast.hpp:736: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:736: error: expected ';' before 'return'
remote: ../src/libsass/ast.hpp:736: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:736: error: expected ')' before 'return'
remote: ../src/libsass/ast.hpp: In member function 'virtual size_t Sass::Function_Call::hash()':
remote: ../src/libsass/ast.hpp:920: error: expected initializer before ':' token
remote: ../src/libsass/ast.hpp:923: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:923: error: expected ';' before 'return'
remote: ../src/libsass/ast.hpp:923: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:923: error: expected ')' before 'return'
remote: In file included from ../src/libsass/ast.cpp:1:
remote: ../src/libsass/ast.hpp: In member function 'virtual size_t Sass::String_Schema::hash()':
remote: ../src/libsass/ast.hpp:1257: error: expected initializer before ':' token
remote: ../src/libsass/ast.hpp:1260: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:1260: error: expected ';' before 'return'
remote: ../src/libsass/ast.hpp:1260: error: expected primary-expression before 'return'
remote: ../src/libsass/ast.hpp:1260: error: expected ')' before 'return'
remote: make: *** [Release/obj.target/binding/src/libsass/ast.o] Error 1
remote: make: Leaving directory `/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass/build'
remote: gyp ERR! build error 
remote: gyp ERR! stack Error: `make` failed with exit code: 2
remote: gyp ERR! stack     at ChildProcess.onExit (/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/lib/build.js:267:23)
remote: gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
remote: gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
remote: gyp ERR! System Linux 2.6.32-504.3.3.el6.x86_64
remote: gyp ERR! command "node" "/opt/rh/nodejs010/root/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
remote: gyp ERR! cwd /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/node_modules/node-sass
remote: gyp ERR! node -v v0.10.25
remote: gyp ERR! node-gyp -v v0.12.2
remote: gyp ERR! not ok 
remote: Build failed
4

1 回答 1

0

此处正在跟踪此问题,应尽快修复。如果它还没有工作,版本 1.2.3 应该可以工作。如果没有,您应该尝试修改 NPM 配置。

如果您使用的是代理,请尝试:

npm config set proxy "http://domain\username:password@servername:port/"

尝试将 NPM 注册表设置为:

npm config set registry http://registry.npmjs.org/

并将您的 NPM 更新到最新版本。

于 2015-01-21T14:20:26.213 回答