2017-02-11 73 views
0

我升级了node.js和npm,并执行了npm安装,现在我得到下面的消息。问题是,我一直在应用程序上工作大约一年,安装了gulp-sass(这是我用来升级我的sass文件),所以显然是升级,但我不知道如何获得一切再次开始,再次降级一切。升级node.js和离子后离子服务器不工作

$ 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`? 

当我尝试npm install gulp-sass

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^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 
+1

您是否尝试过'NPM缓存clean'? – Jackowski

回答

1

我发现了离子论坛问题的解答,相关部分下方是为了清楚起见,一些修改:

只需添加到您的gulpfile.js

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

这条线告诉新的离子2客户端运行旧的离子1.x客户端 “默认”任务之前(运行离子发球之前)

此外,您需要添加您的ionic.config.json文件:

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

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

0

我以前遇到过这个问题。我到目前为止所尝试的:

  1. 重新安装node.js.你可以参考在命令行https://nodejs.org/en/download/
  2. 运行:npm rebuild node-sass

然后试试运行ionic serve。希望它可以帮助你。

+0

没有,得到同样的东西... – SomeoneElse