Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

个人建议:新建项目的时候除了game-server和web-server,把admin-web和robot一起创建出来 #8

Open
zengmax opened this issue Jan 16, 2018 · 15 comments

Comments

@zengmax
Copy link
Contributor

zengmax commented Jan 16, 2018

No description provided.

@mybios
Copy link
Collaborator

mybios commented Jan 16, 2018

这个可以有,后续可以把cli的功能做强大点,让这两个变成可选项。毕竟现在已经是插件模式。

@zengqingsong
Copy link

这个是基于Pomelo的那个版本开发的?

@whtiehack
Copy link
Member

@zengqingsong
yes. pinus 是TS版的 pomelo.并且修复了一些bug,做了一些优化

@NextZeus
Copy link

admin和robot毕竟是工具,项目还是纯净些好。想用admin和robot手动弄一下就行了。

whtiehack added a commit that referenced this issue Dec 6, 2019
Update dependency crc to ^0.3.0
@didoupt
Copy link

didoupt commented May 28, 2020

各位大佬,我是新手一个,想问一下,怎么添加admin-server,和robot-server??

@YunlongJiao-B
Copy link

@didoupeanut
直接看pomelo的文档。。

@didoupt
Copy link

didoupt commented Aug 27, 2020

我把pinus项目中的robot-example 项目独立出来,一编译就报错:
报错信息:
node_modules/pinus-robot/lib/agent/agent.ts:1:17 - error TS2503: Cannot find namespace 'SocketIOClient'.

1 import Socket = SocketIOClient.Socket;

我把example中的websocket-chat 独立出来,也是报错,两者的共同点都是引用了pinus-robot 和pinus-robot-plugn.
这个有大佬帮忙解释一下嘛?

我把引用注释掉就不会有编译问题了

@whtiehack
Copy link
Member

@didoupeanut
目前版本 1.4.10 没有遇到你说的问题

@didoupt
Copy link

didoupt commented Aug 27, 2020

两个插件都是1.4.9,我看看1.4.10有没有这个问题

@didoupt
Copy link

didoupt commented Aug 27, 2020

1.4.10还是有问题。vscode控制台打印:

PS E:\pinus\chat\server-game> npm run build

[email protected] build E:\pinus\chat\server-game
tsc && node copy

node_modules/pinus-robot/lib/agent/agent.ts:1:17 - error TS2503: Cannot find namespace 'SocketIOClient'.

1 import Socket = SocketIOClient.Socket;
~~~~~~~~~~~~~~

Found 1 error.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: tsc && node copy
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2020-08-27T08_54_14_012Z-debug.log

工程配置:
{
"name": "pinus",
"version": "0.0.1",
"private": false,
"bin": {
"$": "./dist/bin/app.js"
},
"main": "./dist/app",
"scripts": {
"start": "npm run build && cd dist && node app",
"build": "node_modules/.bin/tsc && node copy"
},
"dependencies": {
"@types/node": "8.10.54",
"@types/bluebird": "^3.5.19",
"pinus": "1.4.10",
"pinus-robot": "^1.4.10",
"pinus-robot-plugin": "^1.4.10",
"bluebird": "^3.5.1",
"source-map-support": "^0.5.0",
"reflect-metadata": "^0.1.10"
},
"devDependencies": {
"cpy": "^8.1.0",
"tslint": "5.20.1",
"typescript": "3.7.3"
}
}

ts配置文件我没改:

{
"compilerOptions": {
// types option has been previously configured
"types": [
// add node as an option
"node"
],
"module": "commonjs", //指定生成哪个模块系统代码
"target": "es2017",
"lib": [
"es2015",
"es2016",
"es2017",
"esnext.asynciterable"
],
"noImplicitAny": false, //在表达式和声明上有隐含的'any'类型时报错。
"noImplicitThis": false,
"inlineSourceMap": true,
"rootDirs": [
"."
], //仅用来控制输出的目录结构--outDir。
"outDir": "./dist", //重定向输出目录。
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": "node",
"watch": false //在监视模式下运行编译器。会监视输出文件,在它们改变时重新编译。
},
"include": [
".//*.ts", "copy.js"
],
"exclude": [
"./dist/
/."
]
}

我只是释放了app.ts的注释:

import { pinus } from 'pinus';
import * as routeUtil from './app/util/routeUtil';
import { preload } from './preload';
// 就是这行引用,导致ts编译报错,不知道为什么我这里编译会检查依赖,加上了"skipLibCheck": true, 也没用
import { createRobotPlugin } from 'pinus-robot-plugin';

// 原来的代码。。。

// if (app.isMaster()) {
// app.use(createRobotPlugin({ scriptFile: __dirname + '/robot/robot.js' }));
// }

// start app
app.start();

@whtiehack
Copy link
Member

npm install @types/socket.io-client 试一下

@didoupt
Copy link

didoupt commented Aug 28, 2020

可以了,给工程加上这个依赖就可以用robot插件了,

@didoupt
Copy link

didoupt commented Aug 31, 2020

我检查了一下,@types/socket.io-client 这个依赖是在pinus-rpc中添加的,但是在robot插件中没有,pinus中也没有,所以如果没有加上pinus-rpc依赖就会有问题,所以这个是不是考虑加到pinus中呢?或者创建项目的时候给加上? @whtiehack

@whtiehack
Copy link
Member

pinus-robot 有这个依赖的.不知道为什么你那会报错.

@Forever90
Copy link

node_modules/pinus-robot/lib/agent/agent.ts:1:17 - error TS2503: Cannot find namespace 'SocketIOClient'.

1 import Socket = SocketIOClient.Socket;
~~~~~~~~~~~~~~

我用npm中下载的pinus-example-robot, 直接运行dist 可以,但是重新编译ts脚本 就报这个错,是怎么回事呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants