1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ubuntu + webpack + typescript でlibxmljsを使う

Last updated at Posted at 2020-05-17

タイトルの設定で動かない

エラー

こんな実行時エラー

internal/validators.js:117
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:117:11)
    at dirname (path.js:1128:5)
    at Function.getRoot (webpack:///./node_modules/bindings/bindings.js?:154:13)
    at bindings (webpack:///./node_modules/bindings/bindings.js?:60:32)
    at eval (webpack:///./node_modules/libxmljs/lib/bindings.js?:1:92)
    at Object../node_modules/libxmljs/lib/bindings.js (/home/user/dist/index.js:118:1)
    at __webpack_require__ (/home/user/dist/index.js:20:30)
    at eval (webpack:///./node_modules/libxmljs/index.js?:4:16)
    at Object../node_modules/libxmljs/index.js (/home/user/dist/index.js:107:1)
    at __webpack_require__ (/home/user/dist/index.js:20:30) {
  code: 'ERR_INVALID_ARG_TYPE'
}

対応

ここの記述どおりに修正する。
node_modules/libxmls/lib/bindings.js

// module.exports = require('bindings')('xmljs');
module.exports = require('bindings')({
    "bindings": "xmljs",
    "module_root": process.cwd() + "/node_modules/libxmljs",
});

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?