ionic serve error all of a sudden
- Node.js Version: v6.11.0
- OS: Win10 x64
- Scope (install, code, runtime, meta, other?): ionic cordova
- Module (and version) (if relevant):
`$ ionic info
cli packages: (C:\Users\menes\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages: cordova (Cordova CLI) : 8.0.0 Gulp CLI : CLI version 3.9.1 Local version 3.9.1
local packages: Cordova Platforms : android 6.2.3 Ionic Framework : ionic1 1.3.1
System: Android SDK Tools : 25.2.5 Node : v6.11.0 npm : 3.10.10 OS : Windows 10
Environment Variables: ANDROID_HOME : D:\Android_sdk
Misc: backend : pro`
All of a sudden ionic serve stopped working!!! Checked on 2 PCs, haven't done anything serious... An older project, stopped working all of a sudden...
This is what I get:
`$ ionic serve [ERROR] Gulpfile (or dependent module) not found: .\gulpfile.js
For custom Gulpfile locations, you can run ionic config set gulp.file <path>. Otherwise, the default Ionic
Gulpfile can be downloaded from https://github.com/ionic-team/ionic-app-base/blob/master/gulpfile.js
Or, if you don't use gulp, you can disable it by running ionic config set gulp.enabled false.
Full error:
Error: Cannot find module 'bower'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\PhpStorm\MyHoliday\gulpfile.js:3:13)
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)
`
**
- have tried to delete all of Roaming/nmp and npm cache
- have tried to install bower
- have tried to redefine package.json, which is: **
{
"name": "myholiday",
"version": "1.1.1",
"description": "myholiday: An Ionic project",
"devDependencies": {
"gulp": "^3.5.6",
"gulp-clean-css": "^3.7.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^3.1.0"
},
"dependencies": {
"cordova-android": "^6.2.3",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-app-event": "^1.2.1",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-calendar": "^4.6.0",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-dialogs": "^1.3.3",
"cordova-plugin-file": "^4.3.3",
"cordova-plugin-file-transfer": "^1.6.3",
"cordova-plugin-geolocation": "^2.4.3",
"cordova-plugin-google-analytics": "^1.8.3",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-network-information": "^1.3.3",
"cordova-plugin-request-location-accuracy": "^2.2.2",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.1",
"cordova-plugin-whitelist": "^1.3.1",
"cordova-plugin-x-toast": "^2.6.0",
"ionic-plugin-keyboard": "^2.2.1",
"onesignal-cordova-plugin": "^2.2.4",
"phonegap-plugin-barcodescanner": "^6.0.8",
"uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.0.7"
},
"cordova": {
"plugins": {
"ionic-plugin-keyboard": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"phonegap-plugin-barcodescanner": {},
"cordova-plugin-x-toast": {},
"cordova-plugin-request-location-accuracy": {},
"cordova-plugin-network-information": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-google-analytics": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-calendar": {},
"cordova-plugin-app-version": {},
"cordova-plugin-app-event": {},
"uk.co.workingedge.phonegap.plugin.launchnavigator": {},
"onesignal-cordova-plugin": {}
},
"platforms": [
"android"
]
},
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "http://192.168.1.39/ZaHol.git"
}
}
** gulpfile.js **
`var gulp = require('gulp'); var gutil = require('gulp-util'); var bower = require('bower'); var concat = require('gulp-concat'); var sass = require('gulp-sass'); var minifyCss = require('gulp-minify-css'); var rename = require('gulp-rename'); var sh = require('shelljs');
var paths = { sass: ['./scss/**/*'] };
gulp.task('default', ['sass', 'watch']);
gulp.task('sass', function(done) { gulp.src('./scss/ionic.app.scss') .pipe(sass()) .on('error', sass.logError) .pipe(gulp.dest('./www/css/')) .pipe(minifyCss({ keepSpecialComments: 0 })) .pipe(rename({ extname: '.min.css' })) .pipe(gulp.dest('./www/css/')) .on('end', done); });
gulp.task('watch', function() { gulp.watch(paths.sass, ['sass']); });
gulp.task('install', ['git-check'], function() { return bower.commands.install() .on('log', function(data) { gutil.log('bower', gutil.colors.cyan(data.id), data.message); }); });
gulp.task('git-check', function(done) { if (!sh.which('git')) { console.log( ' ' + gutil.colors.red('Git is not installed.'), '\n Git, the version control system, is required to download Ionic.', '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', '\n Once git is installed, run '' + gutil.colors.cyan('gulp install') + '' again.' ); process.exit(1); } done(); });`
Thanks!!!
Did you make any changes/updates to the installed Node.js runtime environment? ( node/npm/node-gyp + python 2.7 )
It sounds like you have modified the package.json, although for many of modules, its configured to obtain the latest... And, that might well be what has propagated change(s) into your ionic environment.
Just solved this by installing ALL plugins again, one by one. This way plugin versions have been updated...
That sounds like you've encountered something of the difficulties reported to the ionic team here, whereby the configurations are maintained in multiple places and its easy enough for them to fall out-of-sync.
Anyway, glad you've solved this predicament and you're up-and-running again. Happy to close?
Well it's an ongoing project, but yeah very close to a next release! :D