如何解决 noscript - 在为 Vue 应用程序提供服务时未启用 JavaScript 无法正常工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55459339/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve noscript - doesn't work properly without JavaScript enabled when serving a Vue App
提问by Alexandru Nutu
I'm setting up a new Vue.JS application using the Vue UI interface.
When I start the application using vue serve src/App.vuethe application starts but it only displays in the page the default Home | About.
When I inspect the page in the HTML I see:
我正在使用 Vue UI 界面设置一个新的 Vue.JS 应用程序。当我使用vue serve src/App.vue应用程序启动应用程序时,它只在页面中显示默认的Home | About. 当我检查 HTML 中的页面时,我看到:
<noscript>
<strong>We're sorry but basicapp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
and in the console I see
在控制台中我看到
[Vue warn]: Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <App> at src/App.vue
<Root>
I am working with the basic application created when running the Vue UI
我正在使用运行 Vue UI 时创建的基本应用程序
I am working with the basic application created when running the Vue UI
If I run the application using the vue uicommand followed by starting the application from the Vue UI it works.
我正在使用运行 Vue UI 时创建的基本应用程序如果我使用vue ui命令运行应用程序,然后从 Vue UI 启动应用程序,它就可以工作。
The reason I want to open the application using the command line is that in Cloud9 where I want to test the application the vue ui starts on localhost and I cannot find a way to open it. The only changes I made to the application files were done only to make the application run inside the Cloud9 container:
changed the package.jsonadded:
我想使用命令行打开应用程序的原因是,在 Cloud9 中我想测试应用程序,vue ui 在本地主机上启动,但我找不到打开它的方法。我对应用程序文件所做的唯一更改只是为了让应用程序在 Cloud9 容器内运行:更改了package.json添加的内容:
"dev": "webpack-dev-server --inline --progress --port 8080 --host 0.0.0.0 --config vue.config.js --public $C9_HOSTNAME",
created the vue.config.jsand added:
创建vue.config.js并添加:
module.exports = {
devServer: {
compress: true,
disableHostCheck: true,
},
}
回答by Manoj Verma
After 2.5 days of search I found that the content in index.html ( We're sorry but basicapp doesn't work properly without JavaScript enabled. Please enable it to continue.) is not an error actually.
经过 2.5 天的搜索,我发现 index.html 中的内容( 很抱歉,如果没有启用 JavaScript,basicapp 无法正常工作。请启用它以继续。)实际上不是错误。
It is default text for those browsers in which javascript is not enable so don't worry about this at all.
它是那些未启用 javascript 的浏览器的默认文本,因此完全不必担心。
To run your application in dev mode you can use Yarn serve command. If you want to build your application then use yarn/npm build and configure/use the index.html present in dist folder without any doubt.
要在开发模式下运行您的应用程序,您可以使用 Yarn serve 命令。如果你想构建你的应用程序,那么毫无疑问地使用 yarn/npm build 并配置/使用 dist 文件夹中的 index.html。
回答by chao zhang
Change the port from 8080 to 8081,it worked for me. I opened another program with port 8080.May cause hash conflict
将端口从 8080 更改为 8081,对我有用。我用8080端口打开了另一个程序。可能会导致哈希冲突
回答by Alexandru Nutu
I found the problem.
To start the application you need to run the command npm run serve. Works well in the Cloud9 container and also on my local machine.
我发现了问题。要启动应用程序,您需要运行命令npm run serve。在 Cloud9 容器和我的本地机器上运行良好。

