jrief / django-formset

The missing widgets and form manipulation library for Django
https://django-formset.fly.dev/
MIT License
326 stars 35 forks source link

Cannot get demo to run, error during `tag-attributes` #4

Closed apollo13 closed 3 years ago

apollo13 commented 3 years ago

I wanted to try out the demo and during tag-attributes I get the following:

> django-formset@0.0.1 tag-attributes
> peggy -o client/django-formset/tag-attributes.ts --extra-options-file assets/pegjsconf.json --plugin ./node_modules/ts-pegjs/src/tspegjs.js assets/tag-attributes.pegjs

Cannot find module 'pegjs/lib/compiler/asts'
Require stack:
- /tmp/django-formset/node_modules/ts-pegjs/src/passes/generate-bytecode-ts.js
- /tmp/django-formset/node_modules/ts-pegjs/src/tspegjs.js
- /tmp/django-formset/node_modules/peggy/bin/peggy

My npm version (if relevant) is 8.0.0, aside from that I simply followed the instructions. npm install looked relatively normal:

npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
⸨##################⸩ ⠴ reify:foundation-sites: http fetch GET 200 https://registry.npmjs.org/foundation-sites/-/foundation-sites-6.6.3.tgz 9194ms (cache miss

added 199 packages, and audited 200 packages in 2m

22 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
npm notice 
npm notice New minor version of npm available! 8.0.0 -> 8.1.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.3
npm notice Run npm install -g npm@8.1.3 to update!
npm notice 

What can I try, any other information I can provide you with (sorry I have literally close to zero ideas on how to fix JS issues :D)?

jrief commented 3 years ago

I'm using npm version 6.14.8. The test runner on GH action uses npm version 6.14.15. Maybe, in newer versions of npm, you have to run npm install --also=dev. Btw., your npm (version 8) comes with which version of NodeJS?

apollo13 commented 3 years ago

The nodeversion is whatever Fedora 35 delivers, according to node --version it is 16.11.1. Installing dev dependencies didn't change anything (up to date, audited 200 packages in 1s). I'll see if I can get another npm version somewhere -- that said I indeed have no pegjs in my node_modules only peggy which does indeed have lib/compiler/asts.js

apollo13 commented 3 years ago

Got it running via the following diff:

diff --git a/package.json b/package.json
index c8da43e..3e58fef 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
     "sass": "^1.32.12",
     "tailwindcss": "^2.2.15",
     "tom-select": "^1.7.8",
-    "ts-pegjs": "^0.3.1",
+    "ts-pegjs": "^1.0.0",
     "tslib": "^2.2.0",
     "typescript": "^4.1.4",
     "uglify-js": "^3.13.8",

Now it imports from peggy instead.

jrief commented 3 years ago

Yes, peggy is the successor of pegjs, which seems to have been abandoned.

OK, I will adopt the GH runner. Thanks for your efforts!

jrief commented 3 years ago

Please retest with 2cf143f I believe that this should have fixed your issues.

apollo13 commented 3 years ago

Jupp that also seems to fix it, thanks! :+1: