-
Notifications
You must be signed in to change notification settings - Fork 119
Closed
Description
When trying to use the library in TypeScript I get the following error messages:
AppComponent_Host.html:1 ERROR TypeError: Arguments to path.resolve must be strings
at Object.exports.resolve (index.js:71)
at findCompiledModule (nbind.js:70)
at find (nbind.js:93)
at Object.init (nbind.js:104)
at new AppComponent (app.component.ts:15)
at createClass (core.es5.js:10910)
at createDirectiveInstance (core.es5.js:10751)
at createViewNodes (core.es5.js:12192)
at createRootView (core.es5.js:12082)
Unhandled Promise rejection: Arguments to path.resolve must be strings ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Arguments to path.resolve must be strings
at Object.exports.resolve (index.js:71)
at findCompiledModule (nbind.js:70)
at find (nbind.js:93)
at Object.init (nbind.js:104)
at new AppComponent (app.component.ts:15)
at createClass (core.es5.js:10910)
at createDirectiveInstance (core.es5.js:10751)
at createViewNodes (core.es5.js:12192)
at createRootView (core.es5.js:12082)
at callWithDebugContext (core.es5.js:13467) TypeError: Arguments to path.resolve must be strings
at Object.exports.resolve (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:62294:13)
at findCompiledModule (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:62132:45)
at find (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:62155:13)
at Object.init (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:62166:5)
at new AppComponent (file:///E:/Projects/streaming/using_nan/streampp/dist/main.bundle.js:107:62)
at createClass (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:11434:20)
at createDirectiveInstance (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:11275:37)
at createViewNodes (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:12716:53)
at createRootView (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:12606:5)
at callWithDebugContext (file:///E:/Projects/streaming/using_nan/streampp/dist/vendor.bundle.js:13991:42)
I am trying to get nbind to work with the Electron Angular Boilerplate at https://github.com/stokingerl/Angular2-Electron-Boilerplate. I forked the repo at https://github.com/kayvanbree/Angular2-Electron-Nbind-Boilerplate.
I updated the package.json to look like this:
{
"name": "electron-angular-nbind-boilerplate",
"productName": "Electron Angular Nbind Boilerplate",
"description": "Electron Angular Boilerplate combined with nbind based on https://github.com/stokingerl/Angular2-Electron-Boilerplate",
"version": "0.0.0",
"license": "MIT",
"author": "Kay van Bree",
"main": "dist/main.js",
"scripts": {
"typings": "npm run -s -- ndts . > src/lib-types.d.ts",
"build-node-gyp": "autogypi && npm run -- node-gyp configure build",
"copy-electron": "copy src\\electron\\* dist",
"build-electron": "npm run build-node-gyp && npm run typings && ng build --base-href . && npm run copy-electron",
"start": "npm run build-electron && electron dist/main.js",
"package-mac": "npm run build-electron && electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --prune=true --out=release-builds",
"package-windows": "npm run build-electron && electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --prune=true --out=release-builds",
"package-linux": "npm run build-electron && electron-packager . --overwrite --asar=true --platform=linux --arch=x64 --prune=true --out=release-builds",
"create-installer-mac": "electron-installer-dmg ./release-builds/Electron\\ Angular\\ Boilerplate-darwin-x64/Electron\\ Angular\\ Boilerplate.app electron-boilerplate-app --out=release-builds --overwrite",
"create-installer-windows": "node installers/windows/createinstaller.js",
"full-build-mac": "npm run build-electron && npm run package-mac && npm run create-installer-mac",
"full-build-windows": "npm run build-electron && npm run package-windows && npm run create-installer-windows",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"autogypi": "autogypi",
"node-gyp": "node-gyp",
"emcc-path": "emcc-path",
"copyasm": "copyasm",
"ndts": "ndts"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"autogypi": "^0.2.2",
"bindings": "^1.3.0",
"core-js": "^2.4.1",
"nan": "^2.8.0",
"nbind": "^0.3.14",
"node-gyp": "^3.6.2",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"electron": "^1.6.2",
"electron-installer-dmg": "^0.2.1",
"electron-packager": "^8.6.0",
"electron-winstaller": "^2.5.2",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}Everything compiles. Typings are being generated to src/lib-types.d.ts. Importing nbind seems to work. LibTypes seems undefined in the devtools debugger though.
The code I'm using to import and use the module is:
import { Component } from '@angular/core';
import * as nbind from 'nbind';
import * as LibTypes from './../lib-types';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app works!';
constructor() {
const lib = nbind.init<typeof LibTypes>().lib;
lib.Greeter.sayHello('Hello');
}
}I also tried the async method, but it gave the same error. How can I fix this?
Metadata
Metadata
Assignees
Labels
No labels