I am in process migrating Angular 5 project to Angular 6.
While starting application by
npm start
getting the below error
In Angular 6 u don't need to write:
"../node_modules/jquery/dist/jquery.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
You can write with ./
like on the top this will works too, but the easiest way in angular.json
file:
"node_modules/jquery/dist/jquery.js",
"node_modules/tether/dist/js/tether.js",
"node_modules/bootstrap/dist/js/bootstrap.js"
In my opinion it's better and clear
For Angular 6 the path is as follows:
from:
"../node_modules/jquery/dist/jquery.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
to
"./node_modules/jquery/dist/jquery.js",
"./node_modules/tether/dist/js/tether.js",
"./node_modules/bootstrap/dist/js/bootstrap.js"
Paths in angular-cli.json are relative to the project root (src/ normally). For instance, you have the src/styles.css file, but in angular-cli.json it's listed only as styles.css.
In your file 'tsconfig.json', you make maybe
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
},
"include": ["node_modules/angular-bootstrap-md/**/*.ts", "src/**/*.ts"],
}
You can replace
"include": ["node_modules/angular-bootstrap-md/**/*.ts", "src/**/*.ts"],
to
"include": ["src/**/*.ts","node_modules/angular-bootstrap-md/**/*.ts" ],
Moreover, in your file 'angular.json', I delete '../' in front of node_modules in "styles" and "scripts".
And I copied lines of the "scripts" in the "scripts" in the category "test"
"test": {
...
"styles": [
"src/styles.css"
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"./assets/css/font-icon.css",
"node_modules/font-awesome/css/font-awesome.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/popper.js/dist/umd/popper.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js"
],
...
Once again the angular team makes things harder for not real reason =(
I had this problem and after Googling around fruitlessly I wondered if they had changed relative paths somehow as well as renaming angular-cli.json.
A little further up in the file I found the line:
Yeah, just change:
"../node_modules/jquery/dist/jquery.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
to
"./node_modules/jquery/dist/jquery.js",
"./node_modules/tether/dist/js/tether.js",
"./node_modules/bootstrap/dist/js/bootstrap.js"