2

I've got a website project in Visual Studio based on the MVC5 project template and published it successfully to Azure continuously.

Since I moved my TFVC workspace from one drive (C:) to another and (Z:) by creating a new workspace and getting latest from source control I got publishing issues:

module.js:327
at node.js:999:3
The 'prepublish' script failed with status code 1.
at Function.Module._load (module.js:276:25)
^
at Function.Module.runMain (module.js:429:10)
at startup (node.js:139:18)
throw err;
at Function.Module._resolveFilename (module.js:325:15)
Cannot find module 'Z:...Website\node_modules\gulp\bin\gulp.js'

enter image description here

My prepublish commands in the project.json file:

"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]

After hours of updating extensions and packages, and running npm commands, I'm lost. Any hint to solve this issue would be appreciated.

I followed this SO question Node.js error in Azure build and changed my prepublish command to this:

"prepublish": [ "npm install", "bower install" ]

That allowed me to publish again, but I'd like to run the gulp commands before publishing.

Community
  • 1
  • 1
Quality Catalyst
  • 6,531
  • 8
  • 38
  • 62

1 Answers1

4

There are 2 options you can follow to try:

  1. Install gulp globally via npm install -g gulp, then the MS build run the tasks in prepublish will use the global gulp modules.
  2. Leverage local gulp tool path. After executing npm install, it should install the node.js modules in the node_modules folder in the same directory with project.json. You can try to modify the gulp commands to "node_modules/.bin/gulp clean" and "node_modules/.bin/gulp min" to use local gulp tool's path to execute the command.

Any further concern, please feel free to let me know.

Gary Liu
  • 13,758
  • 1
  • 17
  • 32