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

博主我有一个疑问 #4

Open
sfsoul opened this issue Mar 10, 2017 · 13 comments
Open

博主我有一个疑问 #4

sfsoul opened this issue Mar 10, 2017 · 13 comments

Comments

@sfsoul
Copy link

sfsoul commented Mar 10, 2017

就是我通过npm run build,然后再本地打开dist文件下面的index.html,会发现js和css引得路径出错,然后我将它们改为正确路径,但是还是提示
GET http://localhost:63342/static/js/3.42d1c4d5ecba6bf82e4b.js
Error: Loading chunk 3 failed.
at HTMLScriptElement.a (bootstrap 0cbc91a…:91)
这些错误是什么原因呢?目前就是底边栏的4个选择都出来了,就是大的页面显示不出来

@zhaohaodang
Copy link
Owner

zhaohaodang commented Mar 10, 2017

因为使用的是路由懒加载,js是被脚本分割成一块一块按需加载,底部、搜索框和头部都是App.vue注册的组件,会在页面打开时正确载入三部分js,而其他组件生成的js因为你修改路径的原因,没能正确加载出来。建议你不要修改路径,也不要手动打开/dist/index.html,应该在/dist下开启http服务 http-server 当然 你需要先安装这个插件,npm install http-server -g

@sfsoul
Copy link
Author

sfsoul commented Mar 10, 2017

我明白前面话的意思,但是我不懂

@sfsoul sfsoul closed this as completed Mar 10, 2017
@sfsoul
Copy link
Author

sfsoul commented Mar 10, 2017

大牛,我明白之前话的意思,也按照你的意思install 了http-server,但请问下下面的步骤是什么吗?
就是在/dis下开启http服务这应该需要如何操作呢?小白第一次尝试麻烦了。

@zhaohaodang
Copy link
Owner

在 /dist 目录下运行命令 http-server 会有类似下面的提示

Starting up http-server, serving ./
Available on:
  http://172.18.30.95:8080
  http://127.0.0.1:8080

然后你在浏览器中访问它输出给你的 http 地址 就像上面的

@sfsoul
Copy link
Author

sfsoul commented Mar 10, 2017

谢谢大牛!我跑起来了!!!

@zhaohaodang zhaohaodang reopened this May 11, 2017
@kawaiyiyuk
Copy link

大神有时间能把Build打包后上线流程写一下么,我也遇到那个朋友相同的问题,上传到服务器后,不改index路径的话,会有路径问题,改了路径又有 Error: Loading chunk 3 failed. 这个问题,小白实在是不知道从何入手去修改了

@zhaohaodang
Copy link
Owner

你需要了解webpack的output.publicPath解决路径问题,修改config/index.js里的build对象

@kawaiyiyuk
Copy link

感谢指导,成功的解决了问题 需要将 assetsPublicPath: '/' 改成assetsPublicPath: './' 再次感谢

@pandaLCW
Copy link

我在我的webpack.base.conf里面加了{
test: /.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test')]
},这段 可是还是报Uncaught SyntaxError: Unexpected token import 请问一下什么意思

@githublxx
Copy link

chalk装上 项目也跑不起来
vue-WeChat-master>npm run dev

vue-wechat@1.0.0 dev D:\Front\vue-WeChat-master
node build/dev-server.js

module.js:550
throw err;
^

Error: Cannot find module 'chalk'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (D:\Front\vue-WeChat-master\build\check-versions.js:1:75)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-wechat@1.0.0 dev: node build/dev-server.js
npm ERR! Exit status 1

@zhaohaodang
Copy link
Owner

zhaohaodang commented Nov 12, 2018 via email

@zhe-he
Copy link

zhe-he commented Dec 25, 2018

@githublxx 这个bug 是window 独有的,
当你安装chalk后又会提示你缺另一个。
出现问题的原因是: 你下载node 模块时中断过(模块的下载机制是先下载配置文件后下载详细内容,模块的判断机制是读取是否有配置文件,这里的bug)
简单的解决方法是 删除你本地的node_modules 然后重新执行 一遍(c)npm install 就可以了。

@wangjiudeng
Copy link

大牛,在浏览器中没有办法发送消息,是只能在手机上发送,电脑上没办法发送嘛,还是没有做发送的功能啊

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

7 participants