1

I have installed Habitat successfully and I have the Sitecore 9.2 running successfully.

I have node (v14.4.0)

gulp verion: CLI (2.3.0) Local (3.9.1)

But I am stuck in VS.NET2019 after opening the Habitat solution.

the Gulp tasks are not loaded due to this error:

    Failed to run "D:\Habitat-1.8.1\Gulpfile.js"...
    cmd.exe /c gulp --tasks-simple
    fs.js:27
    const { Math, Object } = primordials;
                             ^
    ReferenceError: primordials is not defined
        at fs.js:27:26
        at req_ (D:\Habitat-1.8.1\node_modules\natives\index.js:143:24)
        at Object.req [as require] (D:\Habitat-1.8.1\node_modules\natives\index.js:55:10)
        at Object.<anonymous> (D:\Habitat-1.8.1\node_modules\graceful-fs\fs.js:1:37)
        at Module._compile (internal/modules/cjs/loader.js:959:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
        at Module.load (internal/modules/cjs/loader.js:815:32)
        at Function.Module._load (internal/modules/cjs/loader.js:727:14)
        at Module.require (internal/modules/cjs/loader.js:852:19)
        at require (internal/modules/cjs/helpers.js:74:18)

2 Answers 2

1

UPDATE

Visual Studio ships with its own version of Node.js, which is used by default for the Task Runner Explorer. If you have a different version of Node.js installed on your machine, you can use that one by changing the settings in Tools->Options->Projects and Solutions->Web Package Management. Move “$(PATH)” to the top of the list in the “Locations of external tools:” listbox


This is a issue with Gulp v4. I am also facing the same problem with VS 2019.

  1. Please downgrade to gulp 3. Remove all existing installed versions of Gulp.

  2. Try running the gulp task from CMD prompt (opened under Administrator account). VS 2019 is not able to set the environment variables in task runner explorer.

3
  • I removed gulp installation, then installed it with (npm install -g gulp). version 3.9.1 is now installed. then in CMD I tried to run "gulp --tasks-simple" but it gave me the same error
    – mohamed
    Commented Aug 20, 2020 at 10:50
  • sorry i forgot to mention you should use node 10 , also ensure gulp-cli is installed
    – Abhay Dhar
    Commented Aug 20, 2020 at 11:48
  • gulp CLI : 2.3.0, gulp Local : 3.9.1 , node : 10.12.0. it did not work from VS.NET but worked from CMD. Thanks for your help
    – mohamed
    Commented Aug 20, 2020 at 12:24
0

If you want to run this task from Visual studio, Visual studio must be able to work with old version of NodeJS "node 10" , and you can do this by the following

  1. from "Tools" menu open "Options"
  2. In the left menu expand "Projects and Solutions" then "Web Package Management"
  3. In the right section Add " Location of External tools"
  4. Add the path of the Nodejs version 10 , and move this path to the Top
  5. Click "OK" and refresh the task in the "Task Runner Explorer"
  6. After completing your task you can move this path to bottom or remove it if you don't need again

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.