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

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

Open
funder7 opened this issue Jul 18, 2019 · 22 comments

Comments

@funder7
Copy link

funder7 commented Jul 18, 2019

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 (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. (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 [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated [email protected]: 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.

@AGachet
Copy link

AGachet commented Aug 13, 2019

Any solution ? I have exactly the same issue, and I've no idea how to fix it. Downgrading Node version doesn't helped me...

@wangzw
Copy link

wangzw commented Aug 28, 2019

Got same issue.

@mailxcl
Copy link

mailxcl commented Oct 1, 2019

大家解决了吗?我也遇到这个问题了

@mailxcl
Copy link

mailxcl commented Oct 1, 2019

找到办法了,nodejs 12版本的用npm i element-themex --save即可

@thbor
Copy link

thbor commented Nov 5, 2019

找到办法了,nodejs 12版本的用npm i element-themex --save即可

请问是直接用npm i element-themex --save之后再进行官方的安装吗?

@Aprilday
Copy link

node版本降到10.x,重新安装node_modules就好了。

@yzx9
Copy link

yzx9 commented Mar 18, 2020

这个bug似乎仍然存在

node: v12.16.1
npm: 6.13.4

"element-theme": "^2.0.1",
"element-theme-chalk": "^2.13.0"

details:

fs.js:35
} = primordials;
    ^

ReferenceError: primordials is not defined
    at fs.js:35:5
    at req_ (.\node_modules\natives\index.js:143:24)
    at Object.req [as require] (.\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (.\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)

@LesterWeng
Copy link

找到办法了,nodejs 12版本的用npm i element-themex --save即可

可以的

@zboboan
Copy link

zboboan commented Apr 26, 2020

找到办法了,nodejs 12版本的用npm i element-themex --save即可

好像还是不行

@zboboan
Copy link

zboboan commented Apr 26, 2020

找到办法了,nodejs 12版本的用npm i element-themex --save即可

可以的

//安装elementui
npm i element-ui -S

//安装sass
npm i sass-loader node-sass -D

//安装主题工具
npm i element-theme -g

//安装 element-themex
npm i element-themex --save

是怎么弄的?我这里还是报 primordials is not defined

@lucascassiano
Copy link

any fix for this?

@LbISS
Copy link

LbISS commented 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.

@mdogancay
Copy link

mdogancay commented Aug 5, 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.

Nop not working for me.
but i installed element-themex and it works.

@laydll
Copy link

laydll commented Aug 17, 2020

为啥不修复呀

@zboboan
Copy link

zboboan commented Aug 18, 2020

为啥不修复呀

听说 element 团队解散了

@vladislav-sevostyanov
Copy link

I have same problem.

@whidy
Copy link

whidy commented Nov 13, 2020

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

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

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

装这两个就可以了。

其它的跟官方文档一样,

node_modules/.bin/et -i

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

node_modules/.bin/et

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

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

@jackzhujie
Copy link

找到办法了,nodejs 12版本的用npm i element-themex --save即可

感谢,解决了

@YorickLane
Copy link

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

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

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

装这两个就可以了。

其它的跟官方文档一样,

node_modules/.bin/et -i

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

node_modules/.bin/et

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

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

thank you very much! that work for me

@Giwayume
Copy link

Please make it a priority to fix this. Issue has been around for 2 years.

@iDerekLi
Copy link

@Giwayume 人员估计都跑去维护 element-plus 了.🙃

@YongHangPu
Copy link

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

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

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

装这两个就可以了。

其他的跟官方文档一样,

node_modules/.bin/et -i

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

node_modules/.bin/et

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

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

有用,感谢大佬

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