新手问题 用 Node 4.1.1,各种问题

chairy11 · October 02, 2015 · Last by dandananddada replied at October 09, 2015 · 5628 hits

正准备学 ionic,然后各种问题,貌似都是因为 node 版本太新了?

问题一

Error: `libsass` bindings not found. Try reinstalling `node-sass`?

尝试的解决方案是跟着 sass 官方教程:Building on Mac OS X做的,但依然出现同样的错误提示。 我知道我肯定已经装了 libsass 的,但 binding 这是怎么设置? export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 也是设置过了的。

而且

npm ls node-sass
[email protected] /Users/yebiying/Code/a_project
└─┬ [email protected]
  └── [email protected] 

问题二

gyp ERR! stack Error: `make` failed with exit code: 2

完整版本是

 make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd  /Users/yebiying/Code/a_project/node_modules/contextify
gyp ERR! node -v v4.1.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "contextify"
npm ERR! node v4.1.1
npm ERR! npm  v2.14.4
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/yebiying/Code/a_project/npm-debug.log

乱七八糟试了很多,比如什么

sudo npm i -g node-inspector --unsafe-perm npm install contextify

这个帖子有人说『there appears to be an issue with the subdependency contextify installing on node v4. 』好吧,看来版本太新就是坑啊!

要不我还是暂时先卸载 v4.1.1,用回 v0.12.7 吧……好惨…… 呜呜呜,再也不随便升级了……

node 4.1.1 版本用 ionic 是可以的,我本地就成功运行并编译出 ios 版本的 app。 没遇到过这个问题没方法提供解决方案了

我也遇到了楼主所说的两个问题,最后也是悲剧地切换回了 v0.12.7……-_-!

#2 楼 @tzwm 切换回 v0.12.7 倒是解决了 libsass 问题,但 make 问题还在,不知道是不是 xcode 的问题,我明明看到我的 appstore 显示是 xcode7,但命令行好像显示是 xcode6. 你这个问题有没有?

#3 楼 @chairy11 我切换回都正常了,过程中好像 agree 了次 xcode 的新协议。话说,可以期待 v4.2.0 了,将是合并后第一个 LTS。

你的问题 StackOverflow 上都有解答,自己去搜吧。简单地来说,你该用 gulp-sass 2.x。

4+ 都太新了

#5 楼 @darkbaby123 搜出来的答案都试了没效,现在暂时用回 0.12.7 了。不过后来我又怀疑是不是我的 xcode 版本当时还没升到 7,太低了……算了,懒得折腾了……

#5 楼 @darkbaby123 Gulp version: CLI version 3.9.0 gulp-sass "version": "1.3.3"

是有点老哦……好吧,有空再折腾……

我也是用 Node 4.x 和 gulp-sass(也是依赖 node-sass) 一点问题都没有,node-sass 可是第一时间更新支持 Node 4 的,要不就是你那个 contextify 写死了个 node-sass 低版本号。

#9 楼 @muzuiget 有可能,同事写的,他用的 node 版本还是 0.12.4

我最近在看一本书,用的 node 0.8.22。。。我就匿了

You need to Sign in before reply, if you don't have an account, please Sign up first.