Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
517 views
in Technique[技术] by (71.8m points)

nwjs调用dll,require('ref'),TypeError: Cannot read property

项目中我是想使用ffi来调用ddl,往项目中加了ffi ref模块,并使用nw-gyp rebuild了:
rebuild ref:
ref的rebuild

rebuild ffi:
ffi_compile_1.jpg
ffi_compile_2.jpg

但当我要引入ref和ffi是就会报这个错,请问这个是什么引起的?

Snipaste_2020-07-04_18-54-01.jpg

Uncaught TypeError: Cannot read property 'indexOf' of undefined
getFileName @ bindings.js?dfc1:178
bindings @ bindings.js?dfc1:82
(anonymous function) @ ref.js?0e66:5
(anonymous function) @ app.js:1

环境:
node:v10.15.2-x64(也试过v8.17.0-x64,构建时没区别)
系统:win10 64位
nw.js:0.14.7
python:2.7
vs:2015
package.json:

"dependencies": {
    "@babel/runtime": "^7.6.0",
    "axios": "0.18.0",
    "echarts": "^4.2.1",
    "element-ui": "^2.13.1",
    "ffi": "^2.3.0",
    "js-cookie": "2.2.0",
    "moment": "^2.26.0",
    "node-webkit-updater": "^0.3.3",
    "normalize.css": "8.0.1",
    "nprogress": "0.2.0",
    "nw": "0.14.7-sdk",
    "path-to-regexp": "6.1.0",
    "ref": "^1.3.5",
    "ref-array": "^1.2.0",
    "vue": "2.6.11",
    "vue-count-to": "^1.0.13",
    "vue-router": "3.0.6",
    "vuex": "3.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.6.0",
    "@babel/plugin-syntax-dynamic-import": "^7.6.0",
    "@babel/plugin-transform-runtime": "^7.6.0",
    "@babel/preset-env": "7.3.1",
    "autoprefixer": "^6.7.2",
    "babel-eslint": "7.2.3",
    "babel-helper-vue-jsx-merge-props": "2.0.0",
    "babel-loader": "^8.0.6",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-vue-jsx": "^3.7.0",
    "babel-preset-es2015-node6": "^0.4.0",
    "chalk": "^1.1.3",
    "connect-history-api-fallback": "^1.3.0",
    "copy-webpack-plugin": "^6.0.3",
    "css-loader": "^0.26.1",
    "eslint": "^3.14.1",
    "eslint-config-standard": "^6.2.1",
    "eslint-friendly-formatter": "^2.0.7",
    "eslint-loader": "2.1.2",
    "eslint-plugin-html": "^2.0.0",
    "eslint-plugin-promise": "^3.4.0",
    "eslint-plugin-standard": "^2.0.1",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.14.1",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^6.0.0",
    "friendly-errors-webpack-plugin": "^1.1.3",
    "html-webpack-plugin": "3.2.0",
    "http-proxy-middleware": "^1.0.4",
    "iconv-lite": "^0.4.15",
    "innosetup-compiler": "^5.5.9",
    "nw-builder": "^3.5.7",
    "optimize-css-assets-webpack-plugin": "^1.3.0",
    "ora": "^1.1.0",
    "rimraf": "^2.6.0",
    "semver": "^5.3.0",
    "url-loader": "^4.1.0",
    "vue-loader": "^15.7.0",
    "vue-style-loader": "^2.0.0",
    "vue-template-compiler": "2.6.11",
    "webpack": "^4.43.0",
    "webpack-bundle-analyzer": "^3.8.0",
    "webpack-dev-middleware": "^3.7.2",
    "webpack-hot-middleware": "^2.16.1",
    "webpack-merge": "^4.2.2",
    "webpack-node-externals": "^1.7.2"
  }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...