Reputation: 4095
I am trying to move my node_modules to a different location, what I did is deleted the node_modules and moved the package.json to the location I wanted it to be installed, then I ran npm install
which installed the node_modules where I wanted but now, if I run npm start
, the server starts and I get alot of errors:
(index):5 GET http://localhost:3000/node_modules/bootstrap/dist/css/bootstrap.min.css
(index):9 GET http://localhost:3000/node_modules/es6-shim/es6-shim.min.js
(index):10 GET http://localhost:3000/node_modules/systemjs/dist/system-polyfills.js
(index):12 GET http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js
(index):13 GET http://localhost:3000/node_modules/systemjs/dist/system.src.js
(index):14 GET http://localhost:3000/node_modules/rxjs/bundles/Rx.js
(index):15 GET http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js
(index):16 GET http://localhost:3000/node_modules/angular2/bundles/http.dev.js
(index):21 Uncaught ReferenceError: System is not defined(anonymous function) @ (index):21
I updated the index.html file to use the files from root node_modules instead of current dir's node_modules.
What else am I supposed to do to make it work?
Notice that the index.html is in a differnt dir then the node_modules
Upvotes: 2
Views: 3303
Reputation: 4095
The solution is as follow:
Put the following json in that bs-config.json file:
{ "server": { "baseDir": "path/to/your/base/dir/where/you/have/the/index.html/of/your/app", "routes": { "/node_modules": "/path/to/node/modules/relatively/to/this/file" } } }
Edit your package.json file "lite": "lite-server --c bs-config.json"
npm start
and it will work like a magic :DUpvotes: 1