Giter Club home page Giter Club logo

Comments (15)

littledu avatar littledu commented on August 18, 2024

你这个问题问得好,或许你还不知道我们在解决这个问题上的辛酸

from weflow.

littledu avatar littledu commented on August 18, 2024

对于 原生模块(c++) ,需要用 Electron 提供的头文件重新编译,如何编译看这里: http://electron.atom.io/docs/tutorial/using-native-node-modules/

然而, node-sass 并没法按这种正规的方式来重新编译,过程就不说了,多少辛酸多少泪,直接给你结果吧:

sass/node-sass#1047 (comment)

from weflow.

lijialiang avatar lijialiang commented on August 18, 2024

赞!测试了一下,重新编译依赖的win环境较为复杂,mac下重新编译的话木有问题。

from weflow.

littledu avatar littledu commented on August 18, 2024

mac 只占用整个开发时间的百分之三十,大部分时间都在跟 windows 做斗争

from weflow.

lijialiang avatar lijialiang commented on August 18, 2024

请问一下,对于node-sass的window重新编译问题,根据 sass/node-sass#1047 (comment) 在win7系统下重新编译成功后,切换不同的node版本进行 npm start 测试还是会提示环境错误。

from weflow.

littledu avatar littledu commented on August 18, 2024

编译都是跟具体的 node 版本有关的,

from weflow.

Shaman05 avatar Shaman05 commented on August 18, 2024

@littledu 我现在也是碰到这个问题,在win10下开发electron应用碰到require("node-sass")报错了,需要重新编译electron版本的node-sass,捣鼓了好久,但是环境依赖各种蛋疼都快崩溃了。想问下,可否把你编译好的node-sass模块打包发给我,我能直接用吗?

from weflow.

littledu avatar littledu commented on August 18, 2024

@Shaman05

32位 : http://o92gtaqgp.bkt.clouddn.com/win32-ia32-47/binding.node
64 位:http://o92gtaqgp.bkt.clouddn.com/win32-x64-47/binding.node

替换掉 node-sass 下面的 vendor 对应的 binding.node 文件。

这里有我搞的一个项目,专门为 electron 编译,可以看看:
https://github.com/littledu/node-sass-prebuild-for-electron

from weflow.

littledu avatar littledu commented on August 18, 2024

我这个是 node 5.10.0 版本,对应 electron 的版本是 0.37.8,暂时还没时间去升级,如果你不是这些版本,就 fork 一下 https://github.com/littledu/node-sass-prebuild-for-electron ,改一下里面的 appveyor.yml 文件的 node 配置,或者你是哪个版本我来改一下帮你编译一份。

from weflow.

Shaman05 avatar Shaman05 commented on August 18, 2024

@littledu
上面两个都试了,替换掉还是报错了:
ELECTRON_ASAR.js:158 Uncaught Error: %1 is not a valid Win32 application.
?\E:\work\electronPrj\nss2\node_modules\node-sass\vendor\win32-x64-48\binding.node

我克隆clone了node-sass-prebuild-for-electron 到本地修改了配置,编译出错了。我的node是6.3.0,electron是1.2.5的,方便的话,帮我编译一份吧,3Q

from weflow.

littledu avatar littledu commented on August 18, 2024

@Shaman05
试试这个:http://o92gtaqgp.bkt.clouddn.com/win32-x64-48/binding.node

from weflow.

Shaman05 avatar Shaman05 commented on August 18, 2024

谢谢! 替换后报了下面的错误了
ELECTRON_ASAR.js:158 Uncaught Error: Module version mismatch. Expected 48, got 47.

The major version of node used to build the addon is a different major version of node you're using the addon with.
网上查了下,我的理解是指编译node-sass环境的node版本和使用node-sass的electron用的node环境不一致吧,不知是否正确。

如果是这样的话,我用代码

var message = [
Node 版本: ${process.versions.node},
Chrome 版本: ${process.versions.chrome},
Electron 版本: ${process.versions.electron},
System: ${config.osType} / ${config.osPlatform},
${config.title} 版本: ${config.version},
Author: ${config.author} <${config.github}>
];

得到的node版本是6.1.0,上面的6.3.0是我本机的node环境,能帮我用6.1.0再编译一份吗?谢谢

from weflow.

littledu avatar littledu commented on August 18, 2024

@Shaman05

http://o92gtaqgp.bkt.clouddn.com/win32-x64-48/binding.node?v=1234

electron: 1.2.5
node: 6.1.0

记得下载链接后面的时间缀不要去掉,七牛有缓存,所以得加时间缀以免下载到旧版

from weflow.

Shaman05 avatar Shaman05 commented on August 18, 2024

@littledu
OK 3q

from weflow.

yanhaijing avatar yanhaijing commented on August 18, 2024

node-sass:-(

from weflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.