2017-07-05 27 views
0

我安装了node.js,因为我需要一种将我的javascript变量存储到mysql数据库(我使用phpmyadmin)的方法。试图使用node.js,不断收到错误

我得到这个错误,我只是不现在就做什么吧:

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. 

我也输入另一个命令(不记得是哪一个),它给我的列表看起来像用户名和电子邮件帐户。

我不知道我需要采取哪些步骤来成功安装node.js并使其工作。我检查了YouTube视频的内容,但是那里却毫无价值。

所以我从scrath的问题是:我安装了node.js,如何使它工作?

来自荷兰的亲切问候

+0

他们是** ** WARN ING没有错误...试试'NPM init'第一,创造一个'package.json' –

+0

C:\用户\罗宾> NPM的init 该实用程序将引导您创建一个package.json文件。 它只涵盖最常见的项目,并尝试猜测合理的默认值。 请参阅'npm help json'获取这些字段的权威性文档 以及它们的确切用途。 使用'npm install --save'随后安装一个软件包, 将它作为依赖项保存在package.json文件中。 随时按^ C退出。 我越来越了! –

+0

是的,我知道npm init的确感谢你,我建议你按照提示,而不是发布你的电脑从现在开始的每一件小事:p –

回答

0

您需要有package.json文件。 先做:

npm init 

然后你会有package.json。现在,你可以这样做:

npm install package 

或者

npm install package --save (for save dependencies in package.json) 

编辑:

荫试图做一个空文件夹NPM intall在我coputer:

[email protected]:~/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 

那么我packaje .json:

[email protected]:~/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 
[email protected]:~/Proyectos/pruebas/prueba$ 

最新的:

[email protected]:~/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. 
[email protected]:~/Proyectos/pruebas/prueba$ 
+0

当插入:npm初始化它给了我这个:这个工具走....布拉拉。然后: name:(Robin) 然后我键入:npm install package,它会一直说:对不起,名称只能包含url友好字符 –

+0

等待!它让我想到了某个地方。我可以创建一个包: 描述: 切入点: 等等等等 我应该填什么呢? 我有一半的工作休息,马上回来! –

+0

做'npm init -y',所以它不会问你任何东西 –

相关问题