我在本地和全局尝试了超过 4 次,但我不知道如何安装(和配置)nodejs/bower/wysihtml5-editor。这就是发生的事情:
我想使用这个奇特的所见即所得编辑器:here
所以我必须做一些研究,因为我不是专业人士,但我这样做了:
1. sudo apt-get update
2. sudo apt-get install git-core curl build-essential openssl libssl-dev
3. sudo git clone https://www.github.com/joyent/node.git
4. cd node
5. git tag #to see the versions
6. sudo git checkout v0.9.9
7. sudo ./configure
8. sudo make
9. sudo make install
10. sudo curl -L https://www.npmjs.org/install.sh | sudo sh
11. sudo npm -g grunt-cli
12. sudo npm install grunt
13. sudo npm install handlebars -g
14. sudo npm install -g bower
15. bower install bootstrap3-wysihtml5-bower
(这是tutorial)
但是在最后一步我收到了以下错误消息(每个该死的时间):
TypeError: Object #<Object> has no method 'toLowerCase'
at Function.Buffer.isEncoding (buffer.js:240:32)
at assertEncoding (evalmachine.<anonymous>:98:27)
at Object.fs.writeFileSync (evalmachine.<anonymous>:908:3)
at Object.create.all.set (/usr/local/lib/node_modules/bower/node_modules/insight/node_modules/configstore/index.js:64:8)
at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/insight/node_modules/configstore/index.js:27:11)
at new Insight (/usr/local/lib/node_modules/bower/node_modules/insight/lib/index.js:26:34)
at ensureInsight (/usr/local/lib/node_modules/bower/lib/util/analytics.js:26:19)
at Object.setup (/usr/local/lib/node_modules/bower/lib/util/analytics.js:43:9)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/bin/bower:72:11)
at Module._compile (module.js:456:26)
我引用了编辑器依赖的所有文件:
<script src="node/node_modules/handlebars/lib/handlebars.js"></script>
<script src="node/node_modules/handlebars/lib/handlebars.runtime.js"></script>
<script type="text/javascript" src="wysihtml5/dist/bootstrap3-wysihtml5.min.js"></script>
<script type="text/javascript" src="wysihtml5/dist/bootstrap3-wysihtml5.all.min.js"></script>
<link rel="stylesheet" href="wysihtml5/dist/bootstrap3-wysihtml5.min.css">
我用过google,stackoverflow,...但好像没有人遇到这个问题。如果有人能给我答案,我会很高兴。
系统是 Linux XXX 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux。
就像我说的,我卸载了所有组件(grunt、bower、handlebars、npm/nodejs)几次,并在其他目录中尝试过,等等;但没有成功。
我敢打赌,这是一个小错误,“真的让我发疯,让我被解雇”。我应该仅为了使用编辑器而安装 npm 和所有组件吗?还是引用文件就可以了?
我在前端得到的一切都是一个非样式损坏的编辑器......
谢谢大家。 :)
最佳答案
哇,伙计。我明白了。
我重新安装了所有组件,并且在安装时出现了WARN引擎
。所以我将 Node 更新到最新版本。
但是糟糕的前端存在问题。我刚刚发现你必须引用很多文件才能得到正确的结果。
我的 Node 版本:v0.12.0
我的 bower 版本:v1.3.12
我的 npm 版本:v2.5.1
我的nodejs版本:v0.10.36
我不知道您是否需要这些(我不这么认为)来运行编辑器。
这是我引用的文件:
<!-- WYSIHTML5-EDITOR -->
<link href="bower_components/bootstrap/dist/css/bootstrap.min.css" type="text/css" rel="stylesheet">
<link href="bower_components/bootstrap/dist/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet">
<link href="bower_components/components-font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="bower_components/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.all.min.js"></script>
<link rel="stylesheet" href="bower_components/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.css">
<!-- WYSIHTML5-EDITOR -->
<!-- SCRIPTS -->
<script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="bower_components/handlebars/handlebars.runtime.min.js"></script>
<!-- SCRIPTS -->
希望这会对某人有所帮助。
关于node.js - nodejs/bower错误 "toLowerCase",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28592907/