question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceError: primordials is not defined - when trying to generate theme variables file

See original GitHub issue

Hi,

I’m following the guide in the documentation, so I’ve started to follow the steps. I did install all the packages locally, then when launching the command:

/node_modules/.bin/et.cmd -i <path> (I’m on Windows)

It returns an error almost immediately:

`fs.js:27 const { Math, Object, Reflect } = primordials; ^

ReferenceError: primordials is not defined at fs.js:27:35 at req_ (F:\myrepo\myempire\node_modules\natives\index.js:143:24) at Object.req [as require] (F:\myrepo\myempire\node_modules\natives\index.js:55:10) at Object.<anonymous> (F:\myrepo\myempire\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37) at Module._compile (internal/modules/cjs/loader.js:759:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Module.require (internal/modules/cjs/loader.js:666:19) at require (internal/modules/cjs/helpers.js:16:16)`

Ok, I’ve done a quick search and I couldn’t find any solution related to element, but some references to the same issue in other packages, yes.

Looks like with never versions of Node, you get this problem when using: graceful-fs < v4 Seems that even gulp is needed >= v4.

During my tests, I’ve tried to install the element-theme package globally, but nothing changed. But doing that I’ve seen some warnings showing up: npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm WARN deprecated graceful-fs@2.0.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated gulp-util@2.2.20: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

As you can see there are lots of deprecated packages… Now I will try to update them on my machine, I hope to not loose too much time… In case of success I will write a comment.

Anyway I think that this has to be fixed, I was using Node v12, then I installed Node v.10.16.0 which is the current LTS version, and the problem remained.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:14
  • Comments:21

github_iconTop GitHub Comments

29reactions
whidycommented, Nov 13, 2020

根据楼上几位大佬的指点,我发现还是有很多朋友没法解决,我在个人博客总结了一下。可以尝试阅读解决:

如果不想点开,我大致总结下:

npm i element-themex element-theme-chalk -D

装这两个就可以了。

其它的跟官方文档一样,

node_modules/.bin/et -i

创建默认的配置文件element-variables.scss,根据需要修改后再执行

node_modules/.bin/et

进行编译,可能会出现非常多的红色提醒,无视也行。

具体细节可参见顶部提到的文章总结

8reactions
LbISScommented, Jun 4, 2020

It seems issue encountered when no theme installed - fs module cannot find file. According to documentation [https://element.eleme.io/#/en-US/component/custom-theme] you should install any theme (for example, chalk) before calling this command. I have tried and it helped. So if you’ll try (i’m using yarn, for npm the same):

yarn add -D element-theme
node_modules/.bin/et -i 

You’ll get an error: ReferenceError: primordials is not defined

But if you’ll do

 yarn add -D element-theme
 yarn add -D element-theme-chalk
node_modules/.bin/et -i        

the variables will be generated successfully.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix "ReferenceError: primordials is not defined" in Node.js
Solution: Either upgrade to Gulp.js 4 or downgrade to an earlier version of Node.js. Share. Share a link to this ...
Read more >
How to fix "ReferenceError: primordials is not defined" error
Here's what you need to do: · In the same directory where you have package.json create an npm-shrinkwrap.json file with the following contents:....
Read more >
How to fix “ReferenceError: primordials is not defined” error.
1. upgrade gulp to v4 . This Solution Will Solve Your Error. 2. To downgrade Node to v11 To Solve This Error. 3....
Read more >
RE: Liferay Theme Generator 7.2 ? Theme Build Errors with ...
Hello, will there be Liferay Theme Generator for version 7.2 portal? How do we create themes ... ^ReferenceError: primordials is not defined at...
Read more >
Jest mock referenceerror cannot access before initialization
ensureIndex is deprecated; electronjs require is not defined; Module not found: ... to the top of the file, it's not possible to first...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found