make static 错误

2014-03-12 16:48:35 +08:00
 zeroday
尝试在虚拟机中研究这个(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
3678 次点击
所在节点    问与答
14 条回复
cbsw
2014-03-12 18:14:54 +08:00
https://github.com/dengshuan/june 我修改过 assets/Makefile 可以成功 make
cbsw
2014-03-12 18:17:18 +08:00
貌似我应该向 pythoncn 提交一个 pull request
zeroday
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
2014-03-12 19:41:24 +08:00
@cbsw 哈哈,我看到了你提交的pull request了。
cbsw
2014-03-12 20:26:58 +08:00
@zeroday 你装 nib 库了吗?Error: Cannot find module 'nib'
zeroday
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
2014-03-13 09:48:15 +08:00
这就应该是 vagrant 配置问题了,127.0.0.1 只能在本机访问的,远程机器访问需要设置为 0.0.0.0
zeroday
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
2014-03-13 15:49:19 +08:00
不是vagrant本身配置问题,是说你在 vagrant 中运行 runserver 时要指定侦听全网 IP,即 0.0.0.0 ,不记得 june 可不可以直接在命令行指定,Flask你总该知道一些吧,不然怎么玩 june 啊,flask 中指定侦听IP是这样设置的 app.run(host='0.0.0.0')
zeroday
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
2014-03-14 19:03:23 +08:00
先在本机上按说明步骤重新整一遍,等没问题了再往vagrant里扔,本机跑又不会对系统造成什么影响,virtualenv 本身就是虚拟环境了。我刚才又试了一遍,完全没问题。

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

我算是比较有耐心了,每次@我都帮你解决,但如果一直这样作伸手党的话,你自己也学不到什么东西,还浪费别人宝贵的时间。其实最开始的那个错误,你直接将错误提示 “failed to locate @import file nib.styl” 粘到google搜索框里,出来的第一条就是解决方案。说这一大堆并不是打击新手,只是希望新手们能真正主动地去学习提高自己,因为所谓的老鸟也都是这样一步步走过来的,加油,少年!
zeroday
2014-03-15 01:34:16 +08:00
@cbsw 谢谢你的建议,给我很大的启发。也很感谢你花时间为我解决问题。我的问题解决了,是用另一种方法,解决方法是使用ngrok将Vagrant的web服务映射到公网中。修改june的Flask监听ip为0.0.0.0真的不会,还请指教。
cbsw
2014-03-15 11:14:50 +08:00
@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
2014-03-15 15:20:56 +08:00
@cbsw 哦,原来'Server()'内可以提交参数的,这次提问收获很多,你是一个乐于助人的人,谢谢你的帮助。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/104011

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX