与gulp-sass和节点4.1.1的离子问题

时间:2015-10-04 03:15:46

标签: node.js ionic gulp-sass node-sass

这是我使用命令ionic info

的环境
Your system information:

Cordova CLI: 5.3.3
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.0
Ionic Version: 1.1.0
Ionic CLI Version: 1.6.5
Ionic App Lib Version: 0.3.9
OS: Windows 8
Node Version: v4.1.1

当我运行命令npm install时,出现以下错误:

node-sass@2.1.1 install C:\Users\FIDEL-CASA\Desktop\prueba\dsfasdfa\fidel\node
modules\gulp-sass\nodemodules\node-sass
node scripts/install.js

Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/win32-x64-node-4.1/binding.node

node-sass@2.1.1 postinstall C:\Users\FIDEL-CASA\Desktop\prueba\dsfasdfa\fidel\
node_modules\gulp-sass\node_modules\node-sass
node scripts/build.js

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: 404 status code downloading 64-bit node.lib
gyp ERR! stack at Request. (C:\Users\FIDEL-CASA\Desktop\prueba\ds
fasdfa\fidel\node_modules\gulp-sass\node_modules\node-sass\node_modules\pangyp\l
ib\install.js:403:20)
gyp ERR! stack at emitOne (events.js:82:20)
gyp ERR! stack at Request.emit (events.js:169:7)
gyp ERR! stack at Request.onRequestResponse (C:\Users\FIDEL-CASA\Desktop\pru
eba\dsfasdfa\fidel\node_modules\gulp-sass\node_modules\node-sass\node_modules\pa
ngyp\node_modules\request\request.js:1255:10)
gyp ERR! stack at emitOne (events.js:77:13)
gyp ERR! stack at ClientRequest.emit (events.js:169:7)
gyp ERR! stack at HTTPParser.parserOnIncomingClient (httpclient.js:415:21)

gyp ERR! stack at HTTPParser.parserOnHeadersComplete (httpcommon.js:88:23)

gyp ERR! stack at Socket.socketOnData (httpclient.js:305:20)
gyp ERR! stack at emitOne (events.js:77:13)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\FIDEL-CASA\D
esktop\prueba\dsfasdfa\fidel\node_modules\gulp-sass\node_modules\node-sas
s\node_modules\pangyp\bin\node-gyp" "rebuild"
gyp ERR! cwd C:\Users\FIDEL-CASA\Desktop\prueba\dsfasdfa\fidel\node_modules\gulp
-sass\node_modules\node-sass
gyp ERR! node -v v4.1.1
gyp ERR! pangyp -v v2.3.2
gyp ERR! not ok
Build failed
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v4.1.1
npm ERR! npm v2.14.4
npm ERR! path C:\Users\FIDEL-CASA\AppData\Roaming\npm-cache\lodash.template\3.6.
2\package\package.json.85c499c6dffff9035680b8e91062bf92
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\FIDEL-CASA\AppD
ata\Roaming\npm-cache\lodash.template\3.6.2\package\package.json.85c499c6dffff90
35680b8e91062bf92' -> 'C:\Users\FIDEL-CASA\AppData\Roaming\npm-cache\lodash.temp
late\3.6.2\package\package.json'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, rename 'C:\Users\FIDEL-CASA\
AppData\Roaming\npm-cache\lodash.template\3.6.2\package\package.json.85c499c6dff
ff9035680b8e91062bf92' -> 'C:\Users\FIDEL-CASA\AppData\Roaming\npm-cache\lodash.
template\3.6.2\package\package.json']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\Users\FIDEL-CASA\AppData\Roaming\npm-cache\lodash.tem
plate\3.6.2\package\package.json.85c499c6dffff9035680b8e91062bf92',
npm ERR! dest: 'C:\Users\FIDEL-CASA\AppData\Roaming\npm-cache\lodash.tem
plate\3.6.2\package\package.json',
npm ERR! parent: 'gulp-util' }
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\FIDEL-CASA\Desktop\prueba\dsfasdfa\fidel\npm-debug.log

我认为问题是由使用"gulp-sass": "^1.3.3"的{​​{1}}版本引起的。这里https://goo.gl/jFeu7s表示此node-sass版本不适用于节点v4.1.1,即使使用节点v4.0.0也不行。

在这种情况下,您是否建议返回节点v0.12.7?

为什么Ionic不使用更新的gulp-sass版本来解决这个问题?

2 个答案:

答案 0 :(得分:2)

我的节点版本4遇到了同样的问题。*,是的,它是由

引起的
  

“gulp-sass”:“^ 1.3.3”

我解决了这个问题。首先从package.json中删除gulp-sass依赖项,然后尝试

npm install --save gulp-sass @ 2 要么 npm install --save-dev gulp-sass @ 2

答案 1 :(得分:-1)

我刚用这个命令解决了libsass或node-sass的问题:

$ sudo rm -rf node_modules/ && cat package.json | sed -i.bak 's/"gulp-sass": "^X.X.X"/"gulp-sass": "^2.0.4"/g' package.json && npm install && ionic lib update

其中X是package.json中的gulp-sass版本

<强>解释

删除node_modules中的旧文件。我不确定是否有必要使用&#39; sudo&#39; (在我看来,是的)。

$ sudo rm -rf node_modules/

在package.json中搜索并替换gulp-sass版本更新为^ 2.0.4。它还会创建一个备份(package.json.bak),

$ cat package.json | sed -i.bak 's/"gulp-sass": "^X.X.X"/"gulp-sass": "^2.0.4"/g' package.json

重新安装依赖项

$ npm install

更新项目中的离子库

ionic lib update

如果您有任何进一步的问题,请确保我尝试可以帮助您...

再见