npm -g npm --save

npm   --save  安装包会自动添加到项目package.json 文件夹

npm -g  全局安装,会装在c盘

{
  "dependencies": {
     "body-parser": "^1.17.1",
  "cookie-parser": "^1.4.3",
  "express": "^4.15.2",
  "multer": "^1.3.0",
  "pug": "^2.0.0-beta11"
 }
}

时间: 2024-08-04 12:44:16

npm -g npm --save的相关文章

npm 命令参数--save,--save-dev,-g 的区别

常用命令: npm init :创建package.json这个文件 npm run dev :执行npm script中的命令 一.我们在使用 npm install 安装模块的模块的时候 ,一般会使用下面这几种命令形式: npm install moduleName : 安装模块到项目目录下 npm install moduleName -g: -g 将模块安装到全局,具体安装到磁盘哪个位置,要看npm config prefix的位置.查看:npm config ls,修改:npm con

npm init,npm -y, npm install --save,npm install --save-dev

npm init 初始化一个简单的package.json文件,执行该命令后终端会依次询问 name, version, description 等字段 npm init --yes|-y 作用同上,偷懒不用一直按enter npm install packageName 本地安装,安装到项目目录下,不在package.json中写入依赖 npm install  packageName -g 全局安装,安装在Node安装目录下的node_modules下 npm install  packag

npm -g -D -s的区别

npm install module-name 全局安装 npm install module-name -D 即 npm install module-name -save-dev  保存到devDependencies npm Install module-name -S 即 npm install module-name -save  保存到dependencies dependencies 与 devDependencies的区别是 devDependencies里的插件用于开发环境,

tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:56281 npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network

tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:56281npm ERR! network This is most likely not a problem with npm itselfnpm ERR! network and is related to network connectivity.npm ERR! network In most cases you are behi

[NPM] Run npm scripts in series

After creating several npm script it becomes useful to run multiple scripts back-to-back in series. This is a nice feature because you can enforce that one script needs to complete before starting another one. "scripts": { "start": &qu

[Node.js] npm init && npm install

npm init: For create package.json file which will recode the dependence. npm install: You can also write like: npm i This is a shortcut way to write npm install. For example. we want to install undersocre.js npm install -S underscore The way '-S' wor

[NPM] Test npm packages locally in another project using npm link

We will import our newly published package into a new project locally to make sure everything is working as expected. We can do this locally before publishing with npm link. This creates a symbolic link in our node_modules folder, so our unpublished

[NPM] Publish npm packages using npm publish

In this lesson we will publish our package. We will first add a prepublish script that runs our buildscript; this will ensure the built folder gets added to npm when published. We will also add a .npmignore so that only our built files get installed.

linux下离线安装nodejs、npm以及npm插件库(pm2、express等)

一.nodejs安装和npm安装 在nodejs,官网下载nodejs的linux版本,直接解压即可.然后设置为全局 例如 : ln -s /root/nodejs/node-v10.16.0-linux-x64/bin/node /usr/local/bin/node ln -s /root/nodejs/node-v10.16.0-linux-x64/bin/npm /usr/local/bin/npm 然后用node -v 和npm -v测试是否安装成功 二.npm插件库(如express