hustcer / star

A STock Analysis and Research tool for terminal(cli) users. 技术控和命令行爱好者的 A 股辅助分析工具。
MIT License
947 stars 246 forks source link

node 最新版本 12.7 报错 #23

Closed zhang406 closed 9 years ago

zhang406 commented 9 years ago

/usr/bin/env: node --harmony: No such file or directory 这个怎么解决,谢谢

hustcer commented 9 years ago

你node安装成功了么?输入的什么命令?

zhang406 commented 9 years ago

node 安装成功了
root@public:/usr/local/bin# node -v v0.12.7 root@public:/usr/local/bin# which node /usr/local/bin/node 直接输入 命令 star 请大神帮忙解决啊。 root@public:/usr/local/bin# star /usr/bin/env: node --harmony: No such file or directory

zhang406 commented 9 years ago

有mail,qq或者其他的联系方式吗?想让你指导安装一下。谢谢,或者你加我qq 344826638 ,谢谢,本人做系统运维,可以做些技术交流。

hustcer commented 9 years ago

看看这里有类似的问题,把/usr/local/bin/加到你的PATH里面试试看,或者试试:ln -s /usr/local/bin/node /usr/bin/node

hustcer commented 9 years ago

@zhang406 可以了么?

zhang406 commented 9 years ago

谢谢你给的链接,这些方式在求助你之前都已经尝试了,还是不行

zhang406 commented 9 years ago

我想问一下,我编译安装的node v0.12.7 ,你代码具体需要node的那些特性,有没有具体安装star的文档,谢谢支持。

hustcer commented 9 years ago

需要node 支持 es6,你可以试下其他电脑安装是不是有问题?或者换其他版本的node,0.12以上都可以试试,用 nvm 管理node会比较方便。或者试下io.js不过io.js我没试过,你用的什么系统呢?

hustcer commented 9 years ago

star具体安装就在readme里面,已经比较详细了。或者你可以把代码克隆下来安装试试。

zhang406 commented 9 years ago

我在Ubuntu 和centos系统上都试了,都是报同样的错误,那我再换一下稍低一个版本的node试一下。

hustcer commented 9 years ago

你可以试下从源码安装使用:

  1. 您还需要安装 git, 之后 clone star源码:git clone git@github.com:hustcer/star.git;
  2. star目录下安装依赖的 node 模块: sudo npm install;
  3. 运行star: ./star.js,第一次运行的时候需要加-f--file参数指定股票数据文件(推荐采用绝对路径),之后可以省略该参数;
  4. 更多帮助可以参考: ./star.js --help;

然后给 star.js 建个快捷方式

hustcer commented 9 years ago

README.md 里面 加了“从源码安装”部分

zhang406 commented 9 years ago

git clone https://github.com/hustcer/star.git

Initialized empty Git repository in /root/star/.git/ remote: Counting objects: 679, done. remote: Compressing objects: 100% (6/6), done. remote: Total 679 (delta 2), reused 0 (delta 0), pack-reused 67 Receiving objects: 100% (679/679), 1.50 MiB | 229 KiB/s, done. Resolving deltas: 100% (442/442), done. [root@nfs ~]# ls anaconda-ks.cfg drop_caches~ lnmp-install.log pear shutdown_tomcat.sh~ swoole vhost.sh beanstalkd_binlog install.log logs phpconf star test webapps data install.log.syslog mysql_all_backup20150114.sql redis.xml star-master tomact xf9-app-service.war download lnmp mysql_upgrade20150114.log scripts star-master.zip typescript [root@nfs ~]# cd star [root@nfs star]# ls bin eslint.json Gruntfile.js history.md lib LICENSE package.json README.md snapshot star.js symbols.yaml

[root@nfs star]# npm install

iconv@2.1.8 install /root/star/node_modules/iconv node-gyp rebuild

make: Entering directory /root/star/node_modules/iconv/build' CC(target) Release/obj.target/libiconv/deps/libiconv/lib/iconv.o AR(target) Release/obj.target/iconv.a COPY Release/iconv.a CXX(target) Release/obj.target/iconv/src/binding.o SOLINK_MODULE(target) Release/obj.target/iconv.node SOLINK_MODULE(target) Release/obj.target/iconv.node: Finished COPY Release/iconv.node make: Leaving directory/root/star/node_modules/iconv/build' printf@0.2.3 node_modules/printf

colors@1.1.2 node_modules/colors

async@1.4.0 node_modules/async

commander@2.8.1 node_modules/commander └── graceful-readlink@1.0.1

numeral@1.5.3 node_modules/numeral

bluebird@2.9.34 node_modules/bluebird

js-yaml@3.3.1 node_modules/js-yaml ├── esprima@2.2.0 └── argparse@1.0.2 (sprintf-js@1.0.3)

cheerio@0.19.0 node_modules/cheerio ├── entities@1.1.1 ├── dom-serializer@0.1.0 (domelementtype@1.1.3) ├── css-select@1.0.0 (boolbase@1.0.0, css-what@1.0.0, nth-check@1.0.1, domutils@1.4.3) └── htmlparser2@3.8.3 (domelementtype@1.3.0, domutils@1.5.1, entities@1.0.0, domhandler@2.3.0, readable-stream@1.1.13)

blessed@0.1.15 node_modules/blessed

request@2.58.0 node_modules/request ├── caseless@0.10.0 ├── aws-sign2@0.5.0 ├── forever-agent@0.6.1 ├── stringstream@0.0.4 ├── tunnel-agent@0.4.1 ├── oauth-sign@0.8.0 ├── isstream@0.1.2 ├── extend@2.0.1 ├── json-stringify-safe@5.0.1 ├── node-uuid@1.4.3 ├── combined-stream@1.0.5 (delayed-stream@1.0.0) ├── qs@3.1.0 ├── mime-types@2.0.14 (mime-db@1.12.0) ├── http-signature@0.11.0 (assert-plus@0.1.5, asn1@0.1.11, ctype@0.5.3) ├── form-data@1.0.0-rc2 (mime-types@2.1.3) ├── bl@0.9.4 (readable-stream@1.0.33) ├── tough-cookie@2.0.0 ├── hawk@2.3.1 (cryptiles@2.0.4, sntp@1.0.9, boom@2.8.0, hoek@2.14.0) └── har-validator@1.8.0 (chalk@1.1.0, is-my-json-valid@2.12.1)

lodash@3.10.0 node_modules/lodash

grunt@0.4.5 node_modules/grunt ├── which@1.0.9 ├── dateformat@1.0.2-1.2.3 ├── eventemitter2@0.4.14 ├── getobject@0.1.0 ├── rimraf@2.2.8 ├── colors@0.6.2 ├── async@0.1.22 ├── grunt-legacy-util@0.2.0 ├── hooker@0.2.3 ├── exit@0.1.2 ├── nopt@1.0.10 (abbrev@1.0.7) ├── minimatch@0.2.14 (sigmund@1.0.1, lru-cache@2.6.5) ├── lodash@0.9.2 ├── glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3) ├── coffee-script@1.3.3 ├── underscore.string@2.2.1 ├── iconv-lite@0.2.11 ├── grunt-legacy-log@0.1.2 (grunt-legacy-log-utils@0.1.1, underscore.string@2.3.3, lodash@2.4.2) ├── js-yaml@2.0.5 (esprima@1.0.4, argparse@0.1.16) └── findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.2)

moment@2.10.5 node_modules/moment

blessed-contrib@2.3.2 node_modules/blessed-contrib ├── ansi-term@0.0.1 ├── term-canvas@0.0.5 ├── memorystream@0.3.1 ├── marked@0.3.3 ├── sparkline@0.1.2 (here@0.0.2, nopt@2.1.2) ├── chalk@1.1.0 (escape-string-regexp@1.0.3, supports-color@2.0.0, ansi-styles@2.1.0, strip-ansi@3.0.0, has-ansi@2.0.0) ├── memory-streams@0.1.0 (readable-stream@1.0.33) ├── drawille-canvas-blessed-contrib@0.1.2 (bresenham@0.0.3, drawille-blessed-contrib@1.0.0, gl-matrix@2.3.1) ├── marked-terminal@1.5.0 (node-emoji@0.1.0, lodash.assign@3.2.0, cli-table@0.3.1, cardinal@0.5.0) ├── picture-tube@0.0.4 (buffers@0.1.1, x256@0.0.2, charm@0.1.2, request@2.9.203, optimist@0.3.7, event-stream@0.9.8, png-js@0.1.1) └── map-canvas@0.1.5 (xml2js@0.4.9)

grunt-eslint@16.0.0 node_modules/grunt-eslint ├── chalk@1.1.0 (escape-string-regexp@1.0.3, supports-color@2.0.0, ansi-styles@2.1.0, strip-ansi@3.0.0, has-ansi@2.0.0) └── eslint@0.24.1 (escape-string-regexp@1.0.3, path-is-absolute@1.0.0, object-assign@2.1.1, strip-json-comments@1.0.2, user-home@1.1.1, xml-escape@1.0.0, estraverse-fb@1.3.1, globals@8.2.0, estraverse@4.1.0, text-table@0.2.0, espree@2.2.3, debug@2.2.0, mkdirp@0.5.1, optionator@0.5.0, is-my-json-valid@2.12.1, doctrine@0.6.4, minimatch@2.0.10, concat-stream@1.5.0, inquirer@0.8.5, escope@3.2.0)

iconv@2.1.8 node_modules/iconv └── nan@1.8.4 [root@nfs star]# ./star.js /usr/bin/env: node --harmony: No such file or directory

还是这个问题,我哪里少步骤了吗?

hustcer commented 9 years ago

有两种办法:

  1. 把star.js里面的#! /usr/bin/env node --harmony改成 #!/usr/local/bin/node --harmony,然后执行./star.js;
  2. 或者不做修改,直接执行node ./star.js,前面始终加上node;

你试试看

zhang406 commented 9 years ago

终于可以了,一直没发现是这个地方,非常感激。

hustcer commented 9 years ago

不客气,这种问题是比较诡异

zhang406 commented 9 years ago

这些数据来自sina 与腾讯,也仅仅做参考,不过,开发这样的程序,挺牛b的。

zhang406 commented 9 years ago

{ [Error: getaddrinfo ENOTFOUND qt.gtimg.cn] cause: { [Error: getaddrinfo ENOTFOUND qt.gtimg.cn] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'qt.gtimg.cn' }, isOperational: true, code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'qt.gtimg.cn' }

你qt.gtimg.cn 是不是出问题了?

hustcer commented 9 years ago

那是腾讯股票数据接口问题,你可以试试 -d sina 参数,是外部接口问题

zhang406 commented 9 years ago

你那正常吗?

hustcer commented 9 years ago

当然正常

lwldcr commented 9 years ago

bruce@Air™ ~/Downloads/star (master) $$ ./star.js -f test module.js:489 throw err; ^ SyntaxError: /Users/bruce/.star.json: Unexpected end of input at Object.parse (native) at Object.Module._extensions..json (module.js:486:27) at Module.load (module.js:355:32) at Function.Module.load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.Common.getSymbolFilePath (/Users/bruce/Downloads/star/lib/common.js:62:38) at Object..filter..filter..filter._.filter.syms as getFilteredSymbols at Object.actions.TRACE (/Users/bruce/Downloads/star/star.js:112:29) at doCmd (/Users/bruce/Downloads/star/star.js:145:20) at Object. (/Users/bruce/Downloads/star/star.js:149:1) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:501:10) bruce@Air™ ~/Downloads/star (master) $$ node -v v0.12.7

mac 里面跑不起来

hustcer commented 9 years ago

mac下可以的,我用的就是mac,你股票数据文件指定有问题,要用绝对路径,不能用相对路径。你可以把这个文件:/Users/bruce/.star.json删掉,然后重新指定下路径试试

hustcer commented 9 years ago

@lwldcr 可以了么?