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

_electronLog2.default.findLogPath 错误 #8

Open
miaosun009 opened this issue May 3, 2017 · 7 comments
Open

_electronLog2.default.findLogPath 错误 #8

miaosun009 opened this issue May 3, 2017 · 7 comments

Comments

@miaosun009
Copy link

操作系统:win10
node:7.71
electron:1.6.8

运行 npm start 的时候出现以下错误

PS C:\Users\miaosun> d:
PS D:> cd node/edva
PS D:\node\edva> npm start

@ start D:\node\edva
electron app/dist/main

[11:26:26:0115] [info] (main/index) >>>>>>>>>>>>>>>>>>
[11:26:26:0130] [info] (main/index) app start
App threw an error during load
TypeError: _electronLog2.default.findLogPath is not a function
at Object. (D:\node\edva\app\dist\main.js:85:81)
at webpack_require (D:\node\edva\app\dist\main.js:20:30)
at D:\node\edva\app\dist\main.js:40:18
at Object. (D:\node\edva\app\dist\main.js:43:10)
at Object. (D:\node\edva\app\dist\main.js:293:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)

@miaosun009
Copy link
Author

错误是来自 src/main/index.js 中的 第14行
log.info((main/index) log file at ${log.findLogPath()});
改成
log.info((main/index) log file at ${log.transports.file.findLogPath()});
就可以了,
作者修正一下吧

还有把electron 相关的包写进package.js里面把,运行npm start 提示少好几个包呢

@smackgg
Copy link
Contributor

smackgg commented May 3, 2017

@miaosun009
在 app/ 文件夹下还有一个 package.json 所以你还要去app文件夹下 npm install 就不会提示你少包了

为什么把package分离成两部分请仔细看下文档说明 sorrycc/blog#13

@miaosun009
Copy link
Author

@smackgg 还能碰到个活人,真感谢你, 顺便问一下,打包时候遇到的错误,

PS D:\node\edva> npm run pack

@ pack D:\node\edva
npm run build && npm run rebuild && build

@ build D:\node\edva
roadhog build && webpack --config ./webpack.config.main.babel.js

Creating an optimized production build...
⚠️ ⚠️ ⚠️ It's not recommended to use webpack.config.js, since roadhog's major or min
ful of the compatibility after upgrading roadhog.

Compiled successfully.

File sizes after gzip:

83.5 KB app\dist\index.js
275 B app\dist\index.css

输出路径: D:\node\edva\app\dist
Hash: c4fe7441af906b59b269
Version: webpack 1.15.0
Time: 196ms
Asset Size Chunks Chunk Names
main.js 7.53 kB 0 [emitted] main
+ 11 hidden modules

@ rebuild D:\node\edva
electron-rebuild -m ./app/node_modules

× Rebuild Failed
An unhandled error occurred inside electron-rebuild
ENOENT: no such file or directory, open 'D:\node\edva\app\node_modules\package.json'

Error: ENOENT: no such file or directory, open 'D:\node\edva\app\node_modules\package.json'

这是怎么回事呢?

@smackgg
Copy link
Contributor

smackgg commented May 3, 2017

image

还是看文档 sorrycc/blog#13
你试一下镜像。再把包重新装一遍试试。

@Stan-Wang
Copy link

@miaosun009 最后问题是怎么解决的?同样的问题,添加镜像,重新装包还是报同样的错误

@peace-wr
Copy link

peace-wr commented Jun 9, 2017

请教下,那个问题是怎么解决的,我也遇到了同样的问题,把那个镜像加上,同样的错误,求赐教!补充一下,我这里的操作系统是win7,64位

@peace-wr
Copy link

peace-wr commented Jun 9, 2017

刚才路径修改了下,可以了。electron-rebuild -m ./app/node_modules 修改成electron-rebuild -m ./app/

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

4 participants