Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gulpfile.js failed to load in Task Runner Explorer(VS2015.1) #247

Closed
jvdonk opened this issue Jan 22, 2016 · 7 comments
Closed

Gulpfile.js failed to load in Task Runner Explorer(VS2015.1) #247

jvdonk opened this issue Jan 22, 2016 · 7 comments
Assignees

Comments

@jvdonk
Copy link

jvdonk commented Jan 22, 2016

When the VirtoCommerce.Platform.sln is opened, VS(or it's extensions) is successfully picking up the bower.json and package.json and restoring all of its dependencies.

So when it's done, if have the dependencies installed which weren't there before I opened the solution:

image

The dependencies for the gulpfile.js seems to be there but in the Task Runner Explorer window in VS there is an error that it failed to load the Gulpfile.js, more info in the Output-window:

image

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'clone'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\vinyl\index.js:2:13)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\index.js:2:9)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'clone'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\vinyl\index.js:2:13)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\index.js:2:9)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'clone'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\vinyl\index.js:2:13)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\index.js:2:9)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'clone'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\vinyl\index.js:2:13)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\index.js:2:9)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'clone'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\vinyl\index.js:2:13)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\index.js:2:9)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'clone'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\vinyl\index.js:2:13)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\index.js:2:9)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'lodash._getnative'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\lodash.template\node_modules\lodash.keys\index.js:9:17)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\lodash.template\index.js:14:12)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'lodash._getnative'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\lodash.template\node_modules\lodash.keys\index.js:9:17)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\node_modules\gulp-util\node_modules\lodash.template\index.js:14:12)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
'gulp' is not recognized as an internal or external command,
operable program or batch file.

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'main-bower-files'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\gulpfile.js:7:22)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Liftoff.handleArguments (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\bin\gulp.js:116:3)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'main-bower-files'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\gulpfile.js:7:22)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Liftoff.handleArguments (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\bin\gulp.js:116:3)

Failed to run "C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: Cannot find module 'main-bower-files'
    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> (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\gulpfile.js:7:22)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Liftoff.handleArguments (C:\DEV\Test\VirtoCommerce\vc-community-2.6-stripped\PLATFORM\VirtoCommerce.Platform.Web\node_modules\gulp\bin\gulp.js:116:3)

Surely enough it's a local issue, but as I'm fairly new to using task runners: gulp/grunt (I get the concept of task runners etc, just never used them in my projects), I can't seem to find the problem why the Task Runner Explorer isn't liking the gulpfile.js.

If there is another way of building the allPackages.js(for example) than that's fine too. It doesn't have to be the Task Runner Explorer, it's now just the only place I can think of to produce the output of the gulpfile tasks.

@eMazeika
Copy link

I had similar problem some time ago, but then it just started working without changes in gulpfile.js. I suspect that some (solution, Visual Studio) restarting or Task Runner Explorer panel reopening did the trick.
I'll try to reproduce it on a fresh machine and post the status later.

@jvdonk
Copy link
Author

jvdonk commented Jan 25, 2016

When I do a manual 'Restore packages' on the package.json in the VirtoCommerce.Platform.Web project it gives me also errors, which, when on google, suggested updating NPM/Node first.

When checkin the versions in Package Manager Console in VS it listed:

PM> npm -v
2.7.4
PM> node -v
v0.12.2
PM> 

Just updated last week to VS2015 update 1(gruntfile also didn't load with old version of VS2015), so all should be up-to-date but 2.7.4(Node) and 0.12.2(Node) isn't exactly a new version(NPM: March 20, 2015, Node: April 1, 2015) So it looks like MS isn't updating there Node/NPM versions?

There are ways to guide VS to use other versions of Node/NPM, and not messing with the MS tooling: http://jameschambers.com/2015/09/upgrading-npm-in-visual-studio-2015/

But first I'm curious what versions your VS is listing? Maybe my external tooling isn't up-to-date.

@jvdonk
Copy link
Author

jvdonk commented Jan 25, 2016

So I updated NPM using this sublime npm upgrade package: https://github.com/felixrieseberg/npm-windows-upgrade to 3.5.3(latest stable release)

Directed VS to use the global node/npm versions, in Tools\Options, than Projects and Solutions\External Web Tools; Added an entry C:\Program Files (x86)\nodejs and moved it to the top:

image

Cleaned the npm modules cache(npm cache clean) because there were some crippled packages in it, removed the node_modules/client_packages in the VirtoCommerce.Platform.Web folder and restarted VS.

Than all went smooth and the Task Runner Explorer is showing the tasks:
image

Another advantage of the updated NPM is that as of NPM version 3.0.0, all the packages are stored in a flat folder structure, avoiding the Windows long-filename/path problems with the sometimes awfully deeply nested node_modules folders and Windows explorer unable to remove them.

Nice! Hope to help someone else with this walk through :)

Do you want me to close the issue?

@jvdonk
Copy link
Author

jvdonk commented Jan 25, 2016

@eMazeika I also think I have an idea what happened what you were describing.

When you open the solution for the first time there are no client_packages and node_modules folders, there are made when VS discovers the bower.js and package.json. When the Task Runner finds(and processes it to find the tasks) the gulpfile.js before the all the packages(node_modules;client_packages) are restored it displays the same error: failed to load, see output window etc.

When you reactivate(reload solution, reactivate the tab etc) the Task Runner(after all packages are restored) and it processes the gulpfile again, it can find all it's dependencies and shows the task correctly.

@eMazeika
Copy link

nicely done, @jvdonk !
Currently my VS uses these versions:

PM> npm -v
2.14.12
PM> node -v
v4.2.6

I did install nodejs and npm separately and included them to Windows environment path.
Thanks again for your research on this!

@bmnepali
Copy link

bmnepali commented Sep 5, 2017

1+ for @jvdonk answer! Thanks

@mesutpiskin
Copy link

mesutpiskin commented Oct 23, 2017

  1. Go to project directory.
  2. Open the command line in current folder.
  3. Close Visual Studio and VSCode
  4. run npm install
  5. Restart Visual Studio

or (if your source code has not been upgraded)

  1. Uninstall Node
  2. install old Node version (ex: 10.16.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants