簡體   English   中英

在OpenShift上找不到模塊'../build/Debug/iconv.node'

[英]Cannot find module '../build/Debug/iconv.node' on OpenShift

我正在嘗試在OpenShift上部署名為Jingo的Node.js Wiki:

Error: Cannot find module '../build/Debug/iconv.node'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/node_modules/icon
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
DEBUG: Program node jingo -c config.yaml exited with code 8

我嘗試在命令行運行node-gyp configure和node-gyp build,但我沒有足夠的權限。 我也嘗試在package.json文件中包含node-gyp configure和node-gyp build作為安裝腳本但是得到以下錯誤:

remote: > node-gyp configure; node-gyp build
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/550a72cf5973cac5c10000ca/app-root/runtime/repo/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/550a72cf5973cac5c10000ca/app-root/runtime/repo',
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: binding.gyp not found (cwd: /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo) while trying to load binding.gyp
remote: gyp ERR! configure error
remote: gyp ERR! stack Error: `gyp` failed with exit code: 1
remote: gyp ERR! stack     at ChildProcess.onCpExit (/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/lib/configure.js:338:16)
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" "configure"
remote: gyp ERR! cwd /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo
remote: gyp ERR! node -v v0.10.25
remote: gyp ERR! node-gyp -v v0.12.2
remote: gyp ERR! not ok
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 make
remote: gypmake: Entering directory `/var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/build'
remote: make: Leaving directory `/var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/build'
remote:  info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
remote: make: *** No targets specified and no makefile found.  Stop.
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" "build"
remote: gyp ERR! cwd /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo
remote: gyp ERR! node -v v0.10.25
remote: gyp ERR! node-gyp -v v0.12.2
remote: gyp ERR! not ok
remote:
remote: npm info jingo@1.2.6 Failed to exec install script
remote: npm ERR! jingo@1.2.6 install: `node-gyp configure; node-gyp build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the jingo@1.2.6 install script.
remote: npm ERR! This is most likely a problem with the jingo package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR!     node-gyp configure; node-gyp build
remote: npm ERR! You can get their info via:
remote: npm ERR!     npm owner ls jingo
remote: npm ERR! There is likely additional logging output above.
remote: npm ERR! System Linux 2.6.32-504.3.3.el6.x86_64
remote: npm ERR! command "node" "/opt/rh/nodejs010/root/usr/bin/npm" "install" "-d"
remote: npm ERR! cwd /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo
remote: npm ERR! node -v v0.10.25
remote: npm ERR! npm -v 1.3.24
remote: npm ERR! code ELIFECYCLE
remote: npm ERR!
remote: npm ERR! Additional logging details can be found in:
remote: npm ERR!     /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/npm-debug.log
remote: npm ERR! not ok code 0
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/550a72cf5973cac5c10000ca/nodejs
remote:
remote: For more details about the problem, try running the command again with the '--trace' option.
To ssh://550a72cf5973cac5c10000ca@jingo-docusignau.rhcloud.com/~/git/jingo.git/
   f3b5d5e..db51a22  master -> master

還有另一種在OpenShift上安裝和配置node-gyp的方法嗎?

我對此問題的解決方法是手動重建模塊文件夾中的iconv,或者在package.json添加腳本install

  "scripts": {
    "start": "node server.js",
    "install": "cd node_modules/iconv; node-gyp rebuild"
  }

這將強制在每次通過git push自動部署后重建iconv.node

UPD:另一種方法是在文件末尾的.openshift/action_hooks/build中添加腳本:

# rebuilding iconv
if [ -f "${OPENSHIFT_REPO_DIR}/node_modules/iconv"/package.json ]; then
      echo "  - Rebuilding iconv ... "
      echo
      (cd "${OPENSHIFT_REPO_DIR}/node_modules/iconv/"; node-gyp rebuild)
fi

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM