Search code examples
node.jsreactjsnpmgulpsemantic-ui

npm install legacy React with semantic-ui and Gulp


I am trying to install a React legacy project, but I have an error. The project is using semantic-ui 2.2.13, that is the library that seems to have the problem.

When I do npm install --legacy-peer-deps, this message appears:

npm ERR! code 1 npm ERR! path c:\src\project\node_modules\semantic-ui npm ERR! command failed npm ERR! command c:\WINDOWS\system32\cmd.exe /d /s /c gulp installfs.js:47 npm ERR! } = primordials; .... npm ERR! ReferenceError: primordials is not defined npm ERR! at fs.js:47:5 ...

In the detailed log this message apperas

verbose pkgid [email protected] (instead of version 2.2.13)

I have node v16.6.1, npm 7.20.3 and in package.json react ^16.13.0, webpack ^4.23.1 among others

Could you please bring me some light about this?


Solution

  • In summary, your are getting the error because semantic-ui uses Gulp 4, which is not compatible with Node 12 and above. This answer suggests overriding the sub-dependency causing the error. You may follow the issue in the official semantic-ui repo here

    This article also details how to resolve this error.