SomeoneElse
SomeoneElse

Reputation: 486

ionic serve is not working after upgrading node.js and ionic

I upgraded node.js and npm and did an npm install and now I'm getting the message below. The thing is, I have been working on the application for about a year and gulp-sass is installed (it's what I use to upgrade my sass files) so it is clearly do to the upgrade, but I'm not sure how to get everything to work again, sort of downgrading everything again.

$ ionic serve
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'gulp-sass'

Do you need to run `npm install`?

When I try npm install gulp-sass:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\gulp-minify-css\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\karma-junit-reporter\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\karma-mocha-reporter\package.json'
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Users\\Public\\Programs\\nodejs\\node.exe" "C:\\Users\\Someone\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "gulp-sass" "--save"
npm ERR! node v6.9.5
npm ERR! npm  v4.2.0
npm ERR! path E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass' -> 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\.node-sass.DELETE'
npm ERR!     at moveAway (C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:42:5)
npm ERR!     at destStatted (C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:31:7)
npm ERR!     at C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass' -> 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\.node-sass.DELETE'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, rename 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass' -> 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\.node-sass.DELETE'
npm ERR!     at moveAway (C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:42:5)
npm ERR!     at destStatted (C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:31:7)
npm ERR!     at C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass' -> 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\.node-sass.DELETE'
npm ERR!     at Error (native) parent: 'rcreditsmobile' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Someone\AppData\Roaming\npm-cache\_logs\2017-02-11T01_17_29_643Z-debug.log

Upvotes: 0

Views: 837

Answers (2)

SomeoneElse
SomeoneElse

Reputation: 486

I found an answer on the ionic forum that works, the relevant part is below with a few modifications for clarity:

Just add this to your gulpfile.js

gulp.task('serve:before', ['default']);

That line tells the new ionic 2 client to run the old ionic 1.x client 'default' task before serving (before running ionic serve)

Also you need to add your ionic.config.json file this:

{
  ...
  "app_id": "",
  "v2": false,
  "typescript": false,
  "watch": {
    "sass": ["scss/**/*.scss"],
    "html": ["www/**/*.html"],
    "livereload": [
      "www/**/*.html",
      "www/**/*.js",
      "www/**/*.css"
    ]
  }
  ...
}

Ref: https://forum.ionicframework.com/t/ionic2-cli-doesnt-run-gulp-tasks-on-ionic-serve/49085/7

Upvotes: 1

Nere
Nere

Reputation: 4097

I've encountered this problem before. What I've tried so far:

  1. Reinstall the node.js. You may refer https://nodejs.org/en/download/
  2. Run in command line: npm rebuild node-sass

Then try run ionic serve. Hope it helps you.

Upvotes: 0

Related Questions