I am new to node.js and ran into the following problem. I run my node.js app using
cd bin
node www.js
and it works fine.
And in my package.json
I added the following section
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node bin/www.js"
},
now when I type
npm start
in the terminal(I am using vscode)
my project runs normally.
But when I go to a page where some data should be retrieved from the database I get
: Access denied for user 'root'@'localhost'
error.
When I do the same using node www.js
everythings is ok, data is retrieved from db, and there is no prblem.
So what actually does npm start
, I think it should do the same as node www.js
but in fact there is some differences.
what can be the reason of such kind of behaviour?