How to solve noscript - doesn't work properly without JavaScript enabled when serving a Vue App
Asked Answered
L

15

28

I'm setting up a new Vue.JS application using the Vue UI interface. When I start the application using vue serve src/App.vue the application starts but it only displays in the page the default Home | About. When I inspect the page in the HTML I see:

<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

I am working with the basic application created when running the Vue UI If I run the application using the vue ui command followed by starting the application from the Vue UI it works.

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:

"dev": "webpack-dev-server --inline --progress --port 8080 --host 0.0.0.0 --config vue.config.js --public $C9_HOSTNAME",

created the vue.config.js and added:

module.exports = {
  devServer: {
    compress: true,
    disableHostCheck: true,
  },
}
Lacunar answered 1/4, 2019 at 16:7 Comment(7)
did you find a solution since april? – Danialdaniala
Yes. Look at the 1 Answer 😊. Let me know if you need help. – Lacunar
did not work for me. It seems problem is due to lint settings. If I use new Vue({ render: h => h(App, Rating)}).$mount('#app').$mount('#app')will launch the default app, but syntax like new Vue({ el: '#app'})won't. – Danialdaniala
guys, I am also facing the same issue. npm run serve is running fine but We are trying to build the code. once build is generated using npm run build or yarn build if you open the index.html present in dist folder, you find this error message in this html itself. Still have no clue why this error occurs – Pulmotor
@ManojVerma , by default once a vue app is built, it needs to be served from a server - it is not designed to just be opened in the browser ( not by default ). – Paradise
Check the browser console. I had there a "Maximum call stack size exceeded error" and found the answer here: #44520695 – Zwick
Hello, if your trying to hit an API endpoint with postman and getting the same response that JavaScript needs to be enabled, it might simply be because you did not specify a value of Accept - application/json in the Headers section of postman. That was the issue on my end. – Icosahedron
P
10

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.

It is default text for those browsers in which javascript is not enable so don't worry about this at all.

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.

Pulmotor answered 31/1, 2020 at 10:35 Comment(1)
my browser has javascript enabled. I don't know why it doesn't work. – Wivinah
C
5

You need to disable the adblocker or run on incognito mode

Cannular answered 3/11, 2020 at 5:58 Comment(0)
H
2

Change the port from 8080 to 8081,it worked for me. I opened another program with port 8080.May cause hash conflict

Hanks answered 25/2, 2020 at 4:18 Comment(0)
R
2

This occured, when I accidentally set my web directory to the /public instead of the /dist directory. After I changed the apps root to point to the /dist directory in my nginx settings it worked fine.

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name mydomain.com;
    root /path/to/my/website/dist;

    # other settings below...
}
Roger answered 28/9, 2020 at 18:57 Comment(0)
B
1

Vue's build directory, dist, is meant to be served by an HTTP server. Use npm's serve package to serve the folder.

Download using

npm install -g serve

and serve using

serve -s

when in the dist folder or provide path to dist folder

serve -s path/to/dist
Blowsy answered 23/1, 2021 at 18:22 Comment(0)
B
1

I have de same problem, but I don' use http://127.0.0.1:8080 I use ip private http://192.168.100.74:8080/ and It's worked!!! note:use your ip

I had problem with my port 8080 or mi ip

Basalt answered 17/6, 2021 at 4:37 Comment(0)
L
0

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.

Lacunar answered 1/4, 2019 at 17:5 Comment(3)
npm run serve is just to run your dev code. npm run serve is running fine but We are trying to build the code. once build is generated using npm run build or yarn build if you open the index.html present in dist folder, you find this error message in this html itself. Still have no clue why this error occurs. – Pulmotor
OP doesn't have an issue running the application – Gloss
What if I am using yarn? – Wivinah
G
0

Surprisingly, this was solved doing chmod to the root folder.
I used this:

sudo chmod -R 775 path/to/root/folder
Glitter answered 7/7, 2021 at 17:2 Comment(0)
D
0

Was facing a similar issue. Realised that the issue was with my router object.

const router = createRouter({
    history: createWebHistory,
    routes: routes
})

The problem here was that I was using the createWebHistory method as a variable, instead of using it as a method i.e. createWebHistory()

const router = createRouter({
    history: createWebHistory(),
    routes: routes
})
Dufy answered 9/1, 2022 at 8:58 Comment(0)
C
0

I encountered this question too. But in my case is proxy forwarding went wrong. All of my http request are forwarded through a local proxy,but when proxy matching the request prefix occurs an error that prefix matching failed.

image

Congelation answered 1/9, 2022 at 3:40 Comment(0)
V
0

Check your backend configuration if you are using API. In my case I was using Node.js in backend and the issue was coming from my Node.js config, the server was not sending data in a proper JSON object due to the wrong config I did.

Stop the backend server, and run the Vue.js app, and then check if the message is still showing in your browser.

If the message is missing, then your backend is not well configured.

Vachill answered 20/2, 2023 at 14:0 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Ganiats
R
0

It was about vue router.js to me. After commenting out some paths, the site worked.

Turned out the new router that I commented out had the same component as the old route (the one that stopped working):

{
  path: '/good_old_route_stopped_working',
  name: "DogPage",
  component: DogPage
},

{
  path: '/bad_new_route_should_be_removed',
  name: "DogPage",
  component: DogPage
}, 
Refrain answered 18/5, 2023 at 13:9 Comment(0)
S
0

I was seeing this error because my Vue.js library (axios) was reaching out to '/' which was bringing back HTML/JavaScript and it's not able to render it.

At least that's my theory.

I changed the HTTP location to something valid and the error has gone away.

Scrofula answered 17/11, 2023 at 1:33 Comment(0)
C
0

I think it's really tricky. After several hours searching for the resolution, I found it's a VUE embedded code snippet. Open your vue project and expand public folder, you'll see the code We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue. in index.html. If we delete this code and run the build command, there'll be no such noscript node at all.

Chevrotain answered 28/5 at 13:6 Comment(0)
C
-3

'We're sorry but basicapp doesn't work properly without JavaScript enabled. Please enable it to continue.'

This Message will be shown when you open the Browser without javascript :D when you want to see it you should be disable The Javascript in your Browser

Conventual answered 10/8, 2020 at 17:48 Comment(2)
This doesn't sound like it'd solve the original issue. I think the problem is the user wants to view a working version of their app with HTML from rendered components, rather than just the noscript tag. – Ceballos
Thank you for explaining the error message. :) – Goldstein

© 2022 - 2024 — McMap. All rights reserved.