make static 错误 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zeroday
V2EX    问与答

make static 错误

  •  
  •   zeroday 2014-03-12 16:48:35 +08:00 4149 次点击
    这是一个创建于 4287 天前的主题,其中的信息可能已经有所发展或是发生改变。
    尝试在虚拟机中研究这个(https://github.com/pythoncn/june)开源论坛,结果搭载环境,各种出错。

    (venv)vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ make static
    make[1]: Entering directory `/vagrant/www/june/assets'

    install : component/jquery@master
    install : lepture/bootstrap@master
    install : lepture/yue.css@master
    complete : lepture/yue.css
    complete : lepture/bootstrap


    /usr/local/lib/node_modules/stylus/bin/stylus:545
    throw err;
    ^
    Error: stylus/layout.styl:1
    > 1| @import "nib";
    2|
    3| .menu-account {
    4| margin-left: 42px;

    failed to locate @import file nib.styl

    at Evaluator.visitImport (/usr/local/lib/node_modules/stylus/lib/visitor/evaluator.js:882:21)
    at Evaluator.Visitor.visit (/usr/local/lib/node_modules/stylus/lib/visitor/index.js:28:40)
    at Evaluator.visit (/usr/local/lib/node_modules/stylus/lib/visitor/evaluator.js:159:18)
    at Evaluator.visitBlock (/usr/local/lib/node_modules/stylus/lib/visitor/evaluator.js:726:39)
    at Evaluator.Visitor.visit (/usr/local/lib/node_modules/stylus/lib/visitor/index.js:28:40)
    at Evaluator.visit (/usr/local/lib/node_modules/stylus/lib/visitor/evaluator.js:159:18)
    at Evaluator.importFile (/usr/local/lib/node_modules/stylus/lib/visitor/evaluator.js:101:18)
    at Evaluator.visitImport (/usr/local/lib/node_modules/stylus/lib/visitor/evaluator.js:887:27)
    at Evaluator.Visitor.visit (/usr/local/lib/node_modules/stylus/lib/visitor/index.js:28:40)
    at Evaluator.visit (/usr/local/lib/node_modules/stylus/lib/visitor/evaluator.js:159:18)
    make[1]: *** [stylus] Error 8
    make[1]: Leaving directory `/vagrant/www/june/assets'
    make: *** [static] Error 2
    14 条回复    1970-01-01 08:00:00 +08:00
    cbsw
        1
    cbsw  
       2014-03-12 18:14:54 +08:00
    https://github.com/dengshuan/june 我修改过 assets/Makefile 可以成功 make
    cbsw
        2
    cbsw  
       2014-03-12 18:17:18 +08:00
    貌似我应该向 pythoncn 提交一个 pull request
    zeroday
        3
    zeroday  
    OP
       2014-03-12 19:26:46 +08:00
    @cbsw 还是报错。

    (venv)vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ make static
    make[1]: Entering directory `/vagrant/www/june/assets'

    install : component/jquery@master
    install : lepture/bootstrap@master
    install : lepture/yue.css@master


    module.js:340
    throw err;
    ^
    Error: Cannot find module 'nib'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /usr/local/lib/node_modules/stylus/bin/stylus:633:10
    at Array.forEach (native)
    at usePlugins (/usr/local/lib/node_modules/stylus/bin/stylus:630:11)
    at /usr/local/lib/node_modules/stylus/bin/stylus:537:9
    at fs.js:266:14
    at Object.oncomplete (fs.js:107:15)
    make[1]: *** [stylus] Error 8
    make[1]: Leaving directory `/vagrant/www/june/assets'
    make: *** [static] Error 2
    zeroday
        4
    zeroday  
    OP
       2014-03-12 19:41:24 +08:00
    @cbsw 哈哈,我看到了你提交的pull request了。
    cbsw
        5
    cbsw  
       2014-03-12 20:26:58 +08:00   1
    @zeroday 你装 nib 库了吗?Error: Cannot find module 'nib'
    zeroday
        6
    zeroday  
    OP
       2014-03-13 00:23:33 +08:00
    @cbsw 配置应该没问题了,就是浏览器无法链接到服务器,我是在Vagrant上运行的。

    (venv)vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ make static
    make[1]: Entering directory `/vagrant/www/june/assets'

    install : component/jquery@master
    install : lepture/bootstrap@master
    install : lepture/yue.css@master
    complete : lepture/yue.css
    complete : lepture/bootstrap
    complete : component/jquery

    compiled index.css
    make[1]: Leaving directory `/vagrant/www/june/assets'
    (venv)vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ python manager.py createdb
    Traceback (most recent call last):
    File "manager.py", line 5, in <module>
    from flask_script import Manager, Server
    ImportError: No module named flask_script
    (venv)vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ source venv/bin/activate
    (venv)vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ python manager.py createdb
    (venv)vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ python manager.py runserver
    * Running on http://127.0.0.1:5000/
    * Restarting with reloader


    浏览器输入:66.66.66.10:5000,显示无法链接
    cbsw
        7
    cbsw  
       2014-03-13 09:48:15 +08:00
    这就应该是 vagrant 配置问题了,127.0.0.1 只能在本机访问的,远程机器访问需要设置为 0.0.0.0
    zeroday
        8
    zeroday  
    OP
       2014-03-13 13:25:04 +08:00
    @cbsw

    这是我的vagrant配置,没发现有什么问题?

    #This is my Vagrantfile

    Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu64-ruby2"
    config.vm.box_url = "https://dl.dropboxusercontent.com/s/o5i10hcu57jamg8/ubuntu64-ruby2.box"

    config.vm.network :private_network, ip: "66.66.66.10"
    config.vm.network :forwarded_port, guest: 5000, host: 5000
    config.ssh.forward_agent = true
    config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory",[ENV['DISCOURSE_VM_MEM'].to_i, 1024].max]
    end

    end
    cbsw
        9
    cbsw  
       2014-03-13 15:49:19 +08:00   1
    不是vagrant本身配置问题,是说你在 vagrant 中运行 runserver 时要指定侦听全网 IP,即 0.0.0.0 ,不记得 june 可不可以直接在命令行指定,Flask你总该知道一些吧,不然怎么玩 june 啊,flask 中指定侦听IP是这样设置的 app.run(host='0.0.0.0')
    zeroday
        10
    zeroday  
    OP
       2014-03-14 13:56:16 +08:00
    @cbsw 修改了manager.py结果404了

    (venv)vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ python manager.py createdb
    * Running on http://0.0.0.0:5000/
    66.66.66.1 - - [14/Mar/2014 02:54:40] "GET / HTTP/1.1" 404 -
    66.66.66.1 - - [14/Mar/2014 02:54:42] "GET / HTTP/1.1" 404 -
    cbsw
        11
    cbsw  
       2014-03-14 19:03:23 +08:00   1
    先在本机上按说明步骤重新整一遍,等没问题了再往vagrant里扔,本机跑又不会对系统造成什么影响,virtualenv 本身就是虚拟环境了。我刚才又试了一遍,完全没问题。

    另外给个建议:遇到问题请先自己排查,是否遗漏(弄错)某个步骤,自己的环境是否与教程一致(一般请尽量保持一致),不一致的话确认是否会对结果造成影响,如果还是有问题,请先Google一下错误提示,找了20分钟或以上仍然无果,再考虑通过论坛之类的发帖求助。以上建议基本是提问的艺术里面的 http://www.wapm.cn/smart-questions/smart-questions-zh.html ,请仔细通读一遍。

    我算是比较有耐心了,每次@我都帮你解决,但如果一直这样作伸手党的话,你自己也学不到什么东西,还浪费别人宝贵的时间。其实最开始的那个错误,你直接将错误提示 “failed to locate @import file nib.styl” 粘到google搜索框里,出来的第一条就是解决方案。说这一大堆并不是打击新手,只是希望新手们能真正主动地去学习提高自己,因为所谓的老鸟也都是这样一步步走过来的,加油,少年!
    zeroday
        12
    zeroday  
    OP
       2014-03-15 01:34:16 +08:00
    @cbsw 谢谢你的建议,给我很大的启发。也很感谢你花时间为我解决问题。我的问题解决了,是用另一种方法,解决方法是使用ngrok将Vagrant的web服务映射到公网中。修改june的Flask监听ip为0.0.0.0真的不会,还请指教。
    cbsw
        13
    cbsw  
       2014-03-15 11:14:50 +08:00   2
    @zeroday june 使用了 flask_script 来管理 app,不然的话直接可以修改 app.run(host='0.0.0.0'),我没用过 flask_script ,不过刚才去帮你看了一下,应该修改 manager.py 中的 manager.add_command=('runserver', Server(host='0.0.0.0')) 这一行
    zeroday
        14
    zeroday  
    OP
       2014-03-15 15:20:56 +08:00
    @cbsw 哦,原来'Server()'内可以提交参数的,这次提问收获很多,你是一个乐于助人的人,谢谢你的帮助。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     923 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 26ms UTC 19:13 PVG 03:13 LAX 11:13 JFK 14:13
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86