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

TypeError: Invalid options argument #53

Closed
ViSaturn opened this issue Sep 7, 2021 · 3 comments
Closed

TypeError: Invalid options argument #53

ViSaturn opened this issue Sep 7, 2021 · 3 comments

Comments

@ViSaturn
Copy link

ViSaturn commented Sep 7, 2021

Hi, I was trying to run canopy words.peg --lang js on a file I made containing

grammar Words
  root  <-  first:"foo" second:"bar" <Extension>

But everytime I run it I get this error

TypeError: invalid options argument
    at optsArg (/usr/lib/node_modules/canopy/node_modules/mkdirp/lib/opts-arg.js:13:11)
    at mkdirp (/usr/lib/node_modules/canopy/node_modules/mkdirp/index.js:11:10)
    at write (/usr/lib/node_modules/canopy/bin/canopy:32:5)
    at Object.<anonymous> (/usr/lib/node_modules/canopy/bin/canopy:37:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47

My javascript file looks like this

var words = require('./words');

var types = {
  Extension: {
    convert: function() {
      return this.first.text + this.second.text.toUpperCase();
    }
  }
};

words.parse('foobar', {types: types}).convert()
// -> 'fooBAR'

It's the exact same as the example at the end of the page http://canopy.jcoglan.com/langs/javascript.html

What I tried:

  • A different .peg file (same error)
  • Reinstalling canopy from npm (same error)
@jcoglan
Copy link
Owner

jcoglan commented Sep 7, 2021

This is a duplicate of #52, #48, #46, #43, #40, #38, #37.

@jcoglan jcoglan closed this as completed Sep 7, 2021
@ViSaturn
Copy link
Author

ViSaturn commented Sep 7, 2021

oops

@jcoglan
Copy link
Owner

jcoglan commented Apr 1, 2022

This should now be fixed as part of the v0.4 release; see https://blog.jcoglan.com/2022/04/01/announcing-canopy-0-4/

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

No branches or pull requests

2 participants