2

这是我使用命令的环境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"使用"node-sass" : "^2.0.1". 这里https://goo.gl/jFeu7s说这个 node-sass 版本不适用于 node v4.1.1,它甚至不适用于 node v4.0.0。

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

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

4

2 回答 2

2

我的节点版本 4.* 也有同样的问题,是的,这是由

“一饮而尽”:“^1.3.3”

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

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

于 2015-10-04T07:10:26.137 回答
-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 中的旧文件。我不确定是否有必要使用“sudo”(就我而言,是的)。

$ 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

如果您还有任何问题,请确保我可以帮助您...

再见

于 2015-10-17T04:54:47.057 回答