Linked Questions

5 votes
1 answer
3k views

How to use JavaScript import/export without node.js? [duplicate]

The following code worked when run using Visual Studio Code live server. But threw an error when run as distinct file. I tested it online on my web site and in place of './course.js' and './student....
Conk's user avatar
  • 73
0 votes
0 answers
25 views

Javascript: imported identifier is not known when exported correctly [duplicate]

I can't see why such a simple thing like exporting/importing an object/function in Js does not work as intended. Where is my error? core.js: import getPlugins from './plugins.js' plugins.js: ...
nerdoc's user avatar
  • 1,063
6332 votes
72 answers
4.4m views

How do I include a JavaScript file in another JavaScript file?

How do I include a JavaScript file inside another JavaScript file, similar to @import in CSS?
Alec Smart's user avatar
  • 95.3k
1227 votes
29 answers
1.1m views

In Node.js, how do I "include" functions from my other files?

Let's say I have a file called app.js. Pretty simple: var express = require('express'); var app = express.createServer(); app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app....
TIMEX's user avatar
  • 268k
168 votes
46 answers
429k views

NPM: npm-cli.js not found when running npm

Usually I can install a library using npm but today when installing yeoman I encountered this errors. Please help to figure out what's root cause. D:\Works\phonegap\ionic\todo>npm install -g yo ...
user1192476's user avatar
  • 3,405
60 votes
3 answers
51k views

javascript modules and CORS

I am trying to understand modules in JavaScript but when I try to write a very simple module I get CORS error.I am using bracket as my text editor and the odd part is when I'm using live preview in ...
Ahmad Reza's user avatar
17 votes
1 answer
30k views

source URI is not allowed in this document

I am working on a website on my localhost and suddenly I'm now getting this errors. I get this error on Firefox <script> source URI is not allowed in this document And nothing on chrome,` but ...
Ikhlak S.'s user avatar
  • 8,936
3 votes
3 answers
10k views

live-server can't find the file specified

I'm trying to setup a reactjs project and using live-server. My project structure - fa/ -node-modules/ ... -public/ bundle.js index.html -src/ app.js package.json My package.json ...
paul-shuvo's user avatar
  • 1,938
2 votes
3 answers
5k views

How to send postman GET request using file url

I am trying to send a GET request through postman using file URI scheme. An example: file:///absolute/path/to/file.txt The request works properly in any browser, but postman is failing with message: ...
jruizaranguren's user avatar
1 vote
1 answer
2k views

Why can't I import a JavaScript module in an html file?

I've modularised two classes Person and Teacher exactly as shown down below. But when I'm trying to call the Teacher class and use its methods in Index.html, it's generating an error in the console ...
priyamtheone's user avatar
2 votes
1 answer
1k views

Loading JavaScript in HTML files throws a cross origin request error in local environment only for ES6 modules and not for old JS, why?

I have this three files: script.js alert("script") module.mjs alert("module") and index.html <script src="./script.js"></script> <script src="./...
asdru's user avatar
  • 1,242
0 votes
1 answer
841 views

Unable to import JavaScript module due to net::ERR_ABORTED 404 (Not Found) - How to fix?

I've searched this error on different platform and tried the answers but none worked here is my code javascript: import { Octokit } from "./octokit.js"; const TOKEN = "mytoken"; ...
EmPlusPlus's user avatar
0 votes
0 answers
668 views

load angularjs web from local file system

I'm developing an angularjs web page which must be loaded from the local file system. Why not a server: I don't want to use a local server, since this would complicate distributing the web to my work ...
piedramania's user avatar
0 votes
1 answer
103 views

Modal javascript code only works temporarily?

Anyone can guess why this short script isn't working? Oddly enough, I only got it to work on CodePen, and only temporarily (i.e. if it will work in the preview for a bit after you save and then stop) ...
alain_invasion's user avatar