无法从Ionic Cli 4.1.2建立离子版本1

时间:2018-09-19 18:42:29

标签: ionic-framework

我有一个旧的Ionic版本1项目,以及一台经过格式化的Windows 7计算机。

在安装Ionic Cli 4.1.2之后,我尝试构建该Ionic版本1项目,但它给了我错误消息:

  

无法运行sass任务:gulpfile.js中缺少

完整错误消息:

ionic-v1 build
[15:26:57] Cannot load gulp: Error: Error in module: .\gulpfile.js:
Error: Cannot find module ‘internal/util/types’
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at evalmachine.:31:26
at Object. (C:\Users\myuser\myapp\node_modules\gulp\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:11:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
[15:26:57] Cannot run sass task: missing in gulpfile.js

如何编译Ionic版本1项目?

2 个答案:

答案 0 :(得分:1)

尝试重新安装Vinyl-fs

$ rm -rf node_modules/vinyl-fs
$ npm install vinyl-fs

答案 1 :(得分:0)

同一问题


var gulp = require('gulp');
var sass = require('gulp-sass');
var cleanCss = require('gulp-clean-css');
var rename = require('gulp-rename');

var paths = {
  sass: ['./scss/**/*.scss']
};

gulp.task('default', ['sass']);

gulp.task('sass', function(done) {
  gulp.src('./scss/ionic.app.scss')
    .pipe(sass())
    .on('error', sass.logError)
    .pipe(gulp.dest('./www/css/'))
    .pipe(cleanCss({
      keepSpecialComments: 0
    }))
    .pipe(rename({ extname: '.min.css' }))
    .pipe(gulp.dest('./www/css/'))
    .on('end', done);
});

gulp.task('watch', ['sass'], function() {
  gulp.watch(paths.sass, ['sass']);
});