Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path must be a string. Received true. #2685

Closed
jbreckmckye opened this issue Mar 12, 2018 · 1 comment
Closed

Path must be a string. Received true. #2685

jbreckmckye opened this issue Mar 12, 2018 · 1 comment
Labels

Comments

@jbreckmckye
Copy link
Contributor

  • Version: 20.4.1 (also 20.2.0)

  • Target: Mac OS X

Details

When I try to run my Electron build, I get a fatal exception, and no executable is outputted.

This is the exception:

  • electron-builder version=20.4.1
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/electron-builder.yaml
  • Unresolved node modules: @tweenjs/tween.js, browserify-css, deep-assign, envify, load-bmfont, object-assign, present, promise-polyfill, style-attr, three-bmfont-text, webvr-polyfill
  • no native production dependencies
  • packaging       platform=darwin arch=x64 electron=1.8.2 appOutDir=dist/mac

TypeError: Path must be a string. Received true
    at assertPath (path.js:28:11)
    at Object.relative (path.js:1267:5)
    at AppFileWalker.handleSymlink (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/util/NodeModuleCopyHelper.ts:34:23)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/util/NodeModuleCopyHelper.ts:63:24
    at Generator.next (<anonymous>)
From previous event:
    at AppFileWalker.collectNodeModules (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/out/util/NodeModuleCopyHelper.js:161:11)
    at then.it (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/util/AppFileWalker.ts:54:21)
    at runCallback (timers.js:785:20)
    at tryOnImmediate (timers.js:747:5)
    at processImmediate [as _immediateCallback] (timers.js:718:5)
From previous event:
    at AppFileWalker.handleNodeModulesDir (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/util/AppFileWalker.ts:50:8)
    at AppFileWalker.consume (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/util/AppFileWalker.ts:32:21)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/builder-util/src/fs.ts:77:69
From previous event:
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/builder-util/src/fs.ts:72:10
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:155:5)
From previous event:
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/builder-util/src/fs.ts:65:51
    at Generator.next (<anonymous>)
    at go$readdir$cb (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/graceful-fs/graceful-fs.js:149:14)
    at FSReqWrap.oncomplete (fs.js:137:15)
From previous event:
    at walk (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/builder-util/out/fs.js:116:22)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/util/AppFileCopierHelper.ts:39:25
    at Generator.next (<anonymous>)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:155:5)
From previous event:
    at computeFileSets (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/out/util/AppFileCopierHelper.js:82:21)
    at _computeFileSets (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/platformPackager.ts:238:14)
    at MacPackager.copyAppFiles (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/platformPackager.ts:251:27)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/platformPackager.ts:193:10
    at Generator.next (<anonymous>)
    at runCallback (timers.js:785:20)
    at tryOnImmediate (timers.js:747:5)
    at processImmediate [as _immediateCallback] (timers.js:718:5)
From previous event:
    at MacPackager.doPack (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/out/platformPackager.js:269:11)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/macPackager.ts:93:63
    at Generator.next (<anonymous>)
From previous event:
    at MacPackager.pack (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/out/macPackager.js:209:11)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/packager.ts:368:24
    at Generator.next (<anonymous>)
    at xfs.stat (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/fs-extra-p/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:155:5)
From previous event:
    at Packager.doBuild (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/out/packager.js:438:11)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/packager.ts:312:52
    at Generator.next (<anonymous>)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:137:15)
From previous event:
    at Packager._build (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/out/packager.js:382:11)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/packager.ts:274:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:785:20)
    at tryOnImmediate (timers.js:747:5)
    at processImmediate [as _immediateCallback] (timers.js:718:5)
From previous event:
    at Packager.build (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/out/packager.js:338:11)
    at /Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/src/index.ts:50:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder-lib/out/index.js:47:21)
    at build (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder/src/builder.ts:229:10)
    at then (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder/src/cli/cli.ts:48:33)
    at runCallback (timers.js:785:20)
    at tryOnImmediate (timers.js:747:5)
    at processImmediate [as _immediateCallback] (timers.js:718:5)
From previous event:
    at Object.args [as handler] (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder/src/cli/cli.ts:48:33)
    at Object.runCommand (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/yargs/lib/command.js:235:44)
    at Object.parseArgs [as _parseArgs] (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/yargs/yargs.js:1042:24)
    at Object.get [as argv] (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/yargs/yargs.js:957:21)
    at Object.<anonymous> (/Users/jimmybreck-mckye/Projects/navigation-wrangler/node_modules/electron-builder/src/cli/cli.ts:42:15)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)
    at Function.Module._load (module.js:486:3)
    at Function.Module.runMain (module.js:653:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

And these are my Node commands. I am getting these errors with both package and package-test.

"scripts": {
    "clean": "rimraf ./dist ./build",
    "start": "concurrently \"npm run start-compile\" \"npm run start-go\"",
    "start-compile": "npm run clean && parcel watch ./src/renderer/index.html -d build/ --public-url ./ --target=electron --no-hmr",
    "start-go": "wait-on ./build/index.html && cross-env NODE_ENV=development electron .",
    "package": "npm run clean && npm run package-compile && cross-env ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder",
    "package-test": "npm run clean && npm run package-compile && cross-env ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder --dir",
    "package-compile": "cross-env NODE_ENV=production parcel build ./src/renderer/index.html -d build/ --public-url ./ --target=electron && cp -r ./icons/* ./build",
    "postinstall": "cross-env ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder install-app-deps"
  },

These exceptions started occurring with v20.2.0 some time last week - I'm not sure what triggered them. They persist with v20.4.1.

Any advice?

@jbreckmckye jbreckmckye changed the title Cannot build - exception "Path must be a string. Received true." Path must be a string. Received true. Mar 12, 2018
@jbreckmckye
Copy link
Contributor Author

jbreckmckye commented Mar 13, 2018

So. I think I have discovered the cause.

AppFileWalker (in electron-builder-lib) consumes a list of dependency objects. These may have a 'link' property assigned by packageDependencies.ts if the directory is a symlink. But the objects ultimately come from the package.json of each project. What happens if that json already has a link property?

Mozilla's Aframe project has just that. Apparently this is (was?) consumed by another Mozilla project called vr-markup.

I think the best approach is to sanitise objects when they are processed by packageDependencies, perhaps by explicitly setting link=null on the object if the package is not a symlink.

I will try and create a PR this afternoon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants