Giter Site home page Giter Site logo

first-node-app's Introduction

first-node-app

我的node项目

node项目运行

  1. 参考hello_world_flutter 配置nodejs
  2. 新建firstNode.js ;点击debug生成launch.json。 运行就能输出测试的消息打印
  3. Express是一个非常流行的应用程序框架,用于构建和运行Node.js应用程序。npm install -g express-generator
  4. 在当前工作目录执行express first-node-app ;会覆盖git下载的first-node-app项目(这将创建一个myExpressApp使用应用程序内容调用的新文件夹。)
  5. 安装所有应用程序的依赖项(再次作为npm模块提供)cd first-node-app 然后 npm install;最后运行npm start(默认端口3000) 6.如果需要debug的web项目Express,需要修改launch.json 修改成"program": "${workspaceFolder}\bin\www"

本地安装 nmp的中文文档https://www.npmjs.cn/

1. 将安装包放在 ./node_modules 下(运行 npm 命令时所在的目录),如果没有 node_modules 目录,会在当前执行 npm 命令的目录下生成 node_modules 目录。 2. 可以通过 require() 来引入本地安装的包。

全局安装

1. 将安装包放在 /usr/local 下或者你 node 的安装目录。2. 可以直接在命令行里使用。

注意:如果你希望具备两者功能,则需要在两个地方安装它或使用 npm link。

项目目录下的package.json包含项目基本信息和依赖信息,类似java的pom文件

  1. node --version 查看node版本;npm -v 查看npm 版本,检查npm 是否正确安装。
  2. npm init 初始化项目,其实就是创建一个package.json文件。需要根据你自己的情况输入。在最后输入 "yes" 后会生成 package.json 文件
  3. npm adduser (在 npm 资源库中注册用户)输入提示的信息。登陆npm;接下来我们就用以下命令来发布模块:npm publish https://blog.csdn.net/qq_24956515/article/details/80514262
  4. npm install cnpm -g --registry=https://registry.npm.taobao.org 安装cnpm (国内淘宝镜像源);这样就可以使用 5. cnpm 命令来安装模块了cnpm install [name]
  5. npm install 模块名 安装模块;npm install -g express 全局安装express模块
  6. npm list 列出已安装模块,可以指定模块,查看模块的版本信息,加-g查看全局的 ;npm show express 显示express模块详情
  7. npm update 升级当前目录下的项目的所有模块,可以指定模块进行更新;npm update -g express 升级全局安装的express模块 注意:update时,最好在某个模块内运行,以免更新到其他不想更新的模块。
  8. npm uninstall express 删除指定的模块;var http = require("http") node引入模块使用require
  9. npm rm|r|uninstall |un :删除模块,但是不会删除package.json文件dependencies选项中对应的依赖配置 xxx 卸载xxx。多个依赖可用空格分割。xxx -D 卸载xxx,并将依赖信息从package.json中的devDependencies中清除。
  10. npm search jquery (npm search 搜索(快捷方式:find, s)
  11. npm root 查看依赖安装路径(也就是node_modules的路径)-g 查看全局安装路径。
  12. npm view 查看模块的注册信息。列出jquery的所有版本, 如:npm view jquery versions;列出gulp的所有依赖, 如:npm view gulp dependencies
  13. npm <script>:有npm start [],npm stop [],npm test [] 等,该些脚本定义在package.json文件scripts中。
  14. Package.json 属性说明:http://www.runoob.com/nodejs/nodejs-npm.html

first-node-app's People

Contributors

mpv945 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.