Visual Studio Team Services: GULP build task failing on 'CANNOT FIND MODULE' - msbuild

I am trying to set up a CI for my project team. I am pushing an angular/node project to a git repo in Team Services. The build triggers fine until it hits the gulp task. Before that gulp task run steps 1-3:
1. npm config set cache C:\Dev\nodejs\npm-cache --global
2. npm install
3. npm cache clean
**4. gulp default**
5. deploy to azure
The reasons for steps 1 & 2 is because npm install was failing until i set the cache.
my error output:
2016-04-28T17:51:21.0694993Z [command]C:\NPM\Modules\gulp.cmd default --gulpfile C:\a\1\s\PolicyUI\PolicyUI\gulpfile.js --packagePath=C:\a\1\a
2016-04-28T17:51:25.1707118Z module.js:338
2016-04-28T17:51:25.1707118Z throw err;
2016-04-28T17:51:25.1717126Z ^
2016-04-28T17:51:25.1717126Z Error: Cannot find module 'merge-stream'
2016-04-28T17:51:25.1717126Z at Function.Module._resolveFilename (module.js:336:15)
2016-04-28T17:51:25.1727127Z at Function.Module._load (module.js:278:25)
2016-04-28T17:51:25.1727127Z at Module.require (module.js:365:17)
2016-04-28T17:51:25.1738110Z at require (module.js:384:17)
2016-04-28T17:51:25.1747120Z at Object.<anonymous> (C:\a\1\s\PolicyUI\PolicyUI\gulpfile.js:8:13)
2016-04-28T17:51:25.1747120Z at Module._compile (module.js:460:26)
2016-04-28T17:51:25.1757124Z at Object.Module._extensions..js (module.js:478:10)
2016-04-28T17:51:25.1757124Z at Module.load (module.js:355:32)
2016-04-28T17:51:25.1767126Z at Function.Module._load (module.js:310:12)
2016-04-28T17:51:25.1767126Z at Module.require (module.js:365:17)
merge-stream IS there locally and works fine on my machine.
Does anyone know why this fails???
Whenever a build happens in team services, is that an isolated powershell environment where it is building??

We had a similar issue in our team. We had to modify the powershell script manually to point to the right location of the gulp file. There were some path issues in the default script provided. Please look into it and you may find some answers.
Thank you.

Related

Vue Cli: Cannot find module '../package.json' error after npm install

I am not an expert in Vuejs or Vuecli, but I do manage to get stuff working.
I had a project i worked on before using Vuecli3 and webpack and now when I opened it after few weeks to make changes, i get the below error in dev mode
$ vue-cli-service serve --open --mode development --dashboard
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module '../package.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Volumes/Drobo/Dropbox/NASDAQ Dubai/Marketdata-6-Indices/node_modules/.bin/vue-cli-service:5:25)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
Total task duration: 0.15s
The package.json file is right there in the root director and also the .lock file. Dont know what is the reason for this error in compiling.
Any help hightly appreciated
As #vesperknight mentioned in the comment, this issue tends to happen when you move the project's folder to another location.
To solve this (on Linux), from the root directory of your project:
Delete existing node modules.
rm -r node_modules
Reinstall all dependencies:
npm install
The first step seems to be important.

Cloud9 NPM update error "Cannot find module 'npm log'"

Good morning!
I started a new project this morning on Cloud9, and when running "npm init", it prompted an update which I ran.
It seemed to install fine, but now when I went to "npm install" some packages, it returns the following error:
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at /home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/bin/npm-cli.js:22:13
at Object.<anonymous> (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
Any ideas on if this is a Cloud9 bug or if it's fixable?
Many thanks in advance!
I just had this very same issue with the update. I'm guessing there's some cloud9 specific issue with the way the update is handled. Ran the link below and it seems to have resolved the issue. Able to check the version and install packages now.
npm config delete prefix
Hope it helps.

Error running Gulp in Sylius

I've got a new install of Sylius that I'm working with. I just installed NPM and Gulp, and wanted to run Gulp for the first time. I'm getting an error, and have never worked with Gulp or Sylius before, so it's a little hard for me to understand:
gulp
module.js:328
throw err;
^
Error: Cannot find module 'gulp-if'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/www/mysite.com/public_html/Gulpfile.js:2:14)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
This is happening on a Ubuntu system, but it also seems to be throwing the same error on my Mac, with a copy of the same Sylius install on it.
try running npm i -S gulp-if in your project. What this does is install the gulp-if package and saves it in your package.json file

npm module error on 'inflight' when attempting to build semantic UI

I'm attempting to use the React Starter Kit with SemanticUI on Windows. I can install and build RSK, but when I run npm install semantic-ui and go through the set up, I always hit the same module error and I am unsure how to solve it.
gulp build
module.js:341
throw err;
^
Error: Cannot find module 'inflight'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\Alex\AppData\Roaming\npm\node_modules\gulp\node_modules\glob\glob.js:57:16)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
I have tried nuking the directory and reinstalling multiple times, but I am unable to get this to work. What is causing the issue?
You may be hitting the same issues people are having on npm 2701. The issue appears to be related to version updates between installing NPM modules (from a quick read over the later parts of the report). Suggestions include running:
npm set registry https://registry.npmjs.org/
And alternatively, removing all currently installed node modules including globally installed modules (in /usr/node-modules/ or C:\Program Files\nodejs\node_modules for example). The user deleted them manually (i.e. not using npm).
I also faced same issue while running react app. I simply installed it
npm install inflight
Although after it there prompt another error msg which was failed to find moudule 'source-list-map' then I installed it as well
npm install source-list-map
I hope it will help you

Assetic: Cannot find module 'less'

The problem:
I am using laravel 4 + basset for asset management (OSX).
i have added the twitter bootstrap to my composer as a dependency.
I want to compile the less files into a collection:
Basset::collection('TwitterBootstrap', function($collection)
{
// Collection definition.
$collection->add('../vendor/twbs/bootstrap/less/bootstrap.less');
})->apply('Less');
I then try to build the collection:
php artisan basset:build TwitterBootstrap
Which throws the error:
[Assetic\Exception\FilterException]
An error occurred while running:
'/usr/local/bin/node' '/private/var/folders/f4/xjby77695pbcgfdjfclfdqd40000gn/T/assetic_less5y7dnh'
Error Output:
module.js:340
throw err;
^
Error: Cannot find module 'less'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/private/var/folders/f4/xjby77695pbcgfdjfclfdqd40000gn/T/assetic_less5y7dnh:1:74)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
I have installed less globally - im unsure why this is throwing errors/what to fix (my path? a node config? an assetic config?)
I had the same problem and I solved it by installing less with npm :
npm install less
To use less globally, do not run "npm install less" at the root of your project.
Instead add a symlink to the global one (/home/{user}/node_modules/less/) in your project :
ln -s /home/{user}/node_modules/less/ /path/to/project/node_modules/less
ln -s /home/{user}/node_modules/less/bin/lessc /path/to/project/node_modules/less/.bin/lessc
How did you install less?
npm install less
Reference: https://npmjs.org/package/less
Edit... Just saw your footnote.
Another option would be to install lessPHP via composer and use LessphpFilter instead of LessFilter