Reputation: 17636
Working on a project and I've decided to use gulp for Typescript watching and transpiling.
Here are the steps I took to install everything.
All this is done within the root directory of my project:
$ sudo npm update
$ npm -v #1.3.10
$ npm init #to create the package.json
$ sudo npm install gulp -g #installing gulp globally
$ gulp -v # No version number is shown.. why?
$ npm install gulp --save-dev
$ npm install gulp-typescript
$ vim gulpfile.js
Here are the contents of my gulpfile.js:
var gulp = require('gulp');
var ts = require('gulp-typescript');
var tsProject = ts.createProject({
declaration: true,
noExternalResolve: true
});
gulp.task('scripts', function() {
return gulp.src('web/ts/*.ts')
.pipe(ts(tsProject))
.pipe(gulp.dest('web/js'))
});
gulp.task('watch', ['scripts'], function() {
gulp.watch('web/ts/*.ts', ['scripts']);
});
However, I get nothing when I run $ gulp scripts
. No error. What am I doing wrong?
Upvotes: 0
Views: 1349
Reputation: 17636
After MartylX comment, I began checking my npm and node versions and they were clearly not uptodate.. which I thought was awkward seeing that I had installed them recently.
I decided to completely reinstall everything.
$ sudo apt-get remove node
$ sudo apt-get remove nodejs
$ sudo apt-get remove npm
I decided to install NVM:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
And I installed the latest version of node:
$ nvm install stable
$ node -v #v4.1.2
I then reinstalled npm:
$ sudo apt-get install npm
I then updated it:
$ sudo npm update -g npm
$ npm -v #2.14.4
And then I installed gulp globally (as well as at the root of my project):
$ sudo npm install -g gulp
$ npm install gulp --save-dev #make sure you did an npm init if you haven't yet
$ gulp #errors are now shown!
Upvotes: 1