I have an application whose structure is as follows:
-
root:
-
main
- node_modules
-
public folder
-
file1.js
-
file2.js
-
main.css
-
-
server.js
-
source folder
- data.json
- package.json
-
My application is working if I put the package.json file in the main folder and run "npm start" there. But if I try to run the program with the above structure, I am getting errors in accessing the file in the public folder and in the source folder. (no such directory or file found). My package.json file is as follows.
{
"name": "arkadium",
"version": "1.0.0",
"description": "",
"main": "main/server.js",
"dependencies": {
"body-parser": "^1.17.1",
"cookie-parser": "^1.4.3",
"ejs": "^2.5.5",
"ejs-mate": "^2.3.0",
"express-flash": "^0.0.2",
"express": "^4.14.0",
"express-session": "^1.15.2",
"flash": "^1.1.0",
"fs": "^0.0.1-security",
"nodemon": "^1.11.0",
"request": "^2.81.0",
"xmlhttprequest": "^1.8.0"
},
"devDependencies": {},
"scripts": {
"start": "node main/server.js"
},
"author": "Arjun Dass",
"license": "ISC"
}
Why am I getting this error when I am moving the package.json into the root directory? Even if I move the node_modules folder in the root directory, I am getting the same error. How can I get rid of this error. PS: I've been asked to maintain this structure.
via Arjun Dass
No comments:
Post a Comment