Reputation: 1213
I am trying to build my project from Task Runner Explorer.
Project is running fine from cmd, using au run.
The error generates is below:
Failed to run "D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\Gulpfile.ts"...
cmd.exe /c gulp --tasks-simple
D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\gulpfile.js:1
(function (exports, require, module, __filename, __dirname) { define(["require", "exports", "gulp", "gulp-shell"], function (require, exports, gulp, gulp_shell_1) {
^
ReferenceError: define is not defined
at Object.<anonymous> (D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\gulpfile.js:1:63)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at execute (D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\node_modules\gulp\node_modules\gulp-cli\lib\versioned\^4.0.0-alpha.2\index.js:37:18)
at Liftoff.handleArguments (D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\node_modules\gulp\node_modules\gulp-cli\index.js:173:63)
I have below code in Gulpfile.ts
import * as gulp from 'gulp';
import shell from 'gulp-shell';
gulp.task('build-dev', shell.task(['au build --env dev']));
Note: I have used both SystemJS and RequireJS module loader.
I am assuming, the issue is simple that i need to tell somehow to use SystemJS loader either in tsconfig.json or package.json or ???
Any help is appreciated. May be I should provide more detail, but could not justify what. Please comment, if any context can help in resolving above issue.
Thanks.
Upvotes: 1
Views: 2246
Reputation: 61
Just in case you're still experiencing this problem;
It appears that the globally installed gulp in C:\Users\{user}\AppData\Roaming\npm\node_modules
is an outdated version and that this is where the task runner runs from regardless of what you have defined in your package.json
.
In the node.js command prompt, you can uninstall gulp globally using:
npm uninstall gulp -g
As I had gulp declared in my project this actually fixed the problem.
But really what you need is the gulp 4 installed globally;
npm install gulp@next -g
Happy coding!
Upvotes: 2
Reputation: 1213
In Visual Studio Tools->Options->Projects and Solutions->Web Package Management.
Moving $(Path) to first index has resoloved the above issue, may be it was because of node or something else version issue installed independently and in VS.
But still getting another issue at later stage of running task.
The new error is below obviously, it is something else, Can anybody guide a good read overcome these issue:
Failed to run "D:\Irshad\Practice\Aurelia\Demo\AureliaDemo2\Gulpfile.ts"...
cmd.exe /c gulp --tasks-simple
C:\Users\irshad.ali\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:147
console.log(Object.keys(localGulp.tasks)
^
TypeError: Cannot convert undefined or null to object
at logTasksSimple (C:\Users\irshad.ali\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:147:22)
at C:\Users\irshad.ali\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:124:14
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
I have written this as answer but not market as answer, waiting for a great answer. :)
Upvotes: 1