• Node version - 12.22.12
  • Npm version - 6.14.16
  • SPFx version - 1.12.1
  • @microsoft/[email protected]

After npm i, when running Gulp build, its giving error as:

Error: Cannot find module 'node:path'

requireStack: [ 'C:\Users\Documents\node_modules\@microsoft\rush-lib\dist\rush-lib.js', 'C:\Users\Documents\node_modules\@microsoft\rush-lib\lib\index.js', 'C:\Users\Documents\node_modules\@microsoft\spfx-heft-plugins\lib\plugins\devDeployPlugin\SpDevDeploy.js', 'C:\Users\Documents\node_modules\@microsoft\spfx-heft-plugins\lib\index.js', 'C:\Users\Documents\node_modules\@microsoft\sp-build-core-tasks\lib\webpack\ConfigureWebpackTask.js', 'C:\Users\Documents\node_modules\@microsoft\sp-build-core-tasks\lib\index.js', 'C:\Users\Documents\node_modules\@microsoft\sp-build-web\lib\index.js', 'C:\Users\Documents\gulpfile.js', 'C:\Users\AppData\Roaming\npm\node_modules\gulp-cli\lib\shared\require-or-import.js', 'C:\Users\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js', 'C:\Users\AppData\Roaming\npm\node_modules\gulp-cli\index.js', 'C:\Users\AppData\Roaming\npm\node_modules\gulp-cli\bin\gulp.js' ]

  • Could you include your package.json file in the question and perhaps any steps you've already tried to resolve the error, like deleting node_modules folder and running npm install again? If I'm not overlooking anything the versions you use for NodeJs, npm and SPFx should be working just fine when you compare them to the SPFx dev environment compatibility list here learn.microsoft.com/en-us/sharepoint/dev/spfx/compatibility Feb 28 at 6:40

1 Answer 1


When you look at the package.json file in your project, do you see line like this:

"engines": {
"node": ">=16.13.0 <17.0.0 || >=18.17.1 <19.0.0"},

If you do, then you need to upgrade node version, but not the newest version, but the version that is allowed by this formula, i.e. 18.17.2

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.