Reputation: 11
I installed node.js because I needed a way for storing my javascript variables into a mysql database (I use phpmyadmin).
I'm getting this error and I just don't now what to do with it:
C:\Users\Robin> npm install mysql
C:\Users\Robin
`-- [email protected]
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Robin\package.json'
npm WARN Robin No description
npm WARN Robin No repository field.
npm WARN Robin No README data
npm WARN Robin No license field.
I also typed another command (can't remember which one) and it gave me a list of what looks like usernames and email-accounts.
I have no idea which steps I need to take for succesfully installing node.js and make it work. I checked youtube video's and stuff but there like worthless.
So my question from scrath is: I installed node.js, how to make it work?
Kind regards from the Netherlands
Upvotes: 1
Views: 11677
Reputation: 101
Well, I may get your problem . Then i searched and found some valuable steps for you from the internet .
Create a new project: mkdir mysql-test && cd mysql-test.
Create a package.json file: npm init -y.
Install the mysql module: npm install mysql.
Create an app.js file and copy in the snippet below (editing the placeholders as appropriate). Run the file: node app.js. Observe a “Connected!” message
Here is the Url where i got these information :https://www.sitepoint.com/using-node-mysql-javascript-client/
Best of luck .
Upvotes: 1
Reputation: 113
You need have package.json file. Do first:
npm init
Then you will have package.json. Now you can do:
npm install package
Or
npm install package --save (for save dependencies in package.json)
EDIT:
Iam trying do npm intall in a void folder in my coputer:
diego.martin@csa-188:~/Proyectos/pruebas/prueba$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (prueba) Hello
Sorry, name can no longer contain capital letters.
name: (prueba) hello
version: (1.0.0)
description: None
entry point: (index.js)
test command:
git repository:
keywords:
author: Diego
license: (ISC)
About to write to /home/diego.martin/Proyectos/pruebas/prueba/package.json:
{
"name": "hello",
"version": "1.0.0",
"description": "None",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Diego",
"license": "ISC"
}
Is this ok? (yes) yes
Then i have packaje.json:
diego.martin@csa-188:~/Proyectos/pruebas/prueba$ ls -la
total 12
drwxrwxr-x 2 diego.martin diego.martin 4096 jul 5 13:30 .
drwxr-xr-x 11 diego.martin diego.martin 4096 jul 5 13:25 ..
-rw-rw-r-- 1 diego.martin diego.martin 210 jul 5 13:30 package.json
diego.martin@csa-188:~/Proyectos/pruebas/prueba$
Lastest:
diego.martin@csa-188:~/Proyectos/pruebas/prueba$ npm install mysql --save
[email protected] /home/diego.martin/Proyectos/pruebas/prueba
└─┬ [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
└── [email protected]
npm WARN [email protected] No repository field.
diego.martin@csa-188:~/Proyectos/pruebas/prueba$
Upvotes: 0