-2
Good evening to all the programmers. I’ve been struggling to do something that probably for some should be absurdly easy, but I’m not getting it at all. That is, install and run the Vue.
I’ve tried to:
> npm install -g @vue/cli
And appears:
Token não reconhecido no texto de origem.
Em linha:1 caractere:16
+ npm install -g <<<< @vue/cli
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnrecognizedToken
I have tried "npm install Vue", and it arrives to install dependencies, but when opening in live-server it does not run at all.
I already deleted everything and tried to do it again, I tried to apply CDN directly to html...and well, nothing.
Vue via CDN in HTML:
<!doctype html>
<html lang="en">
<head>
<title>Title</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div id="app">
{{ 2+2 }}
{{ text }}
</div>
<!-- o CDN -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<!-- Meu código Vue -->
<script>
const app = new Vue = ({
el:'#app',
data: {
text: 'test'
}
});
</script>
</body>
</html>
NOTE: I already tried applying the Cdn link to the head, that I had seen it in a course, but it was not also. When you open the HTML, you write exactly what is in the code. " {{ 2 + 2 }}" without the result 4, and "{{ text }}" exactly the same.
I ask for your help please. Thank you!
Thank you very much for your reply. Simply apply the CDN in the Head tag field, instead of applying at the end of Body, as is "usually recommended" for JS implementations. I believe it is due to the manipulation of Vue with DOM...but, anyway, I’m new enough to be talking some nonsense.
– Nivs Van