filamentgroup / grunticon

A mystical CSS icon solution.
MIT License
3.3k stars 211 forks source link

ReferenceError: primordials is not defined #347

Closed stratboy closed 2 years ago

stratboy commented 4 years ago

Currently on osx 10146, grunticon 232, node 12141.

When I launch the grunt command on a grunticon folder, I keep getting ReferenceError: primordials is not defined. Also

Warning: Task "grunticon:icons" not found. Use --force to continue.

how to solve?

lukebooroo commented 4 years ago

Also getting the same issue, seems to be on Node versions 12+

stratboy commented 4 years ago

Seems devs doesn't look here too much :)

lukebooroo commented 4 years ago

Anyone happen to know a good alternative? Hopefully one that I could migrate easily to 😂

rulrok commented 4 years ago

I found this SO answer

One reply:

I hit the same error. I suspect you're using node 12 and gulp 3. That combination does not work: https://github.com/gulpjs/gulp/issues/2324

A previous workaround from Jan. does not work either: https://github.com/gulpjs/gulp/issues/2246

Solution: Either upgrade to gulp 4 or downgrade to an earlier node.

Another reply:

Origin of the problem This issue stems from the fact that gulp@3.9.1 depends on graceful-fs@^3.0.0 which monkeypatches Node.js fs module.

This used to work with Node.js until version 11.15 (which is a version from a development branch and shouldn't be used in production).

graceful-fs@^4.0.0 does not monkeypatch Node.js fs module anymore, which makes it compatible with Node.js > 11.15.

Note that this is not a perennial solution but it helps when you don't have time to update to gulp@^4.0.0.

But instead of going through the hassle of upgrading node version and what not, this particular answer solved the issue for me.

If your project is in active development and you use npm

Using npm-force-resolutions as a preinstall script, you can obtain a similar result as with yarn v1. You need to modify your package.json this way:

{ // Your current package.json "scripts": { // Your current package.json scripts "preinstall": "npx npm-force-resolutions" }, "resolutions": { "graceful-fs": "4.2.3" } }


> 
> npm-force-resolutions will alter the package-lock.json file to set graceful-fsto the wanted version before the install is done.
stratboy commented 4 years ago

So gulp and not grunt?

rulrok commented 4 years ago

@stratboy Oh, the same happend for me with grunt and the fixes worked as well. :+1:

troylutton commented 3 years ago

Guys we had the same problem and we used the same workaround that @rulrok mentioned. This works with NPM and shrinkwrap. Alternatively a node downgrade to < v12 also works.

The problem for us is that we use Yarn w/workspaces and Monorepos and the only real solution was to go back to a version of node < 12 or use NPM instead of yarn. We'd prefer to use all the new shiny things and we'd love to see grunticon keep on being a first class member of the grunt world.

If the team here at could (pretty please) just update their dependencies so that they're compatible with Node >= 12 then that would be completely awesome and it would give life to Grunticon for many years. @zachleat @scottjehl @toddparker

scottjehl commented 3 years ago

Hi! This seems fine and reasonable. I'll set a reminder to take a look in the morning.

That aside, we need to give this pattern/project a look for moving forward. In our projects, we're typically embedding SVG directly or externally from sprites or direct files now and not necessarily using workflows to generate fallback images since svg browser support is very good.

This project, while still not totally ready for distribution, has been a decent alternative for us recently https://github.com/filamentgroup/iconoclash

troylutton commented 3 years ago

thank you @scottjehl that would be great!

scottjehl commented 3 years ago

@troylutton happy to fix it up. Could you help clarify for me the extent of the change? I'd like to get a PR to test and I'm seeing some notes about gulp, which shouldn't be a dependency for this... Just want to get the change right. thanks!

khateeb321 commented 3 years ago

@rulrok fix worked for me!

Muffinman commented 2 years ago

Just had this myself with an old legacy project. For me the fix was from the same StackOverflow post but the newer npm syntax:

{
  // Your current package.json
  "overrides": {
    "graceful-fs": "^4.2.9"
  }
}