摘要:分鐘搞定模塊開發創建組建新建目錄初始化創建新建測試文件大家好,我是春哥,我的電話是執行大家好,我是春哥,我的電話是發布到去官網注冊一個自己的開發賬號到注冊賬號記住自己的賬號,密碼,郵箱。
3分鐘搞定NPM模塊開發 創建組建 新建目錄
localhost:Desktop yuechunli$ pwd /Users/liyuechun/Desktop localhost:Desktop yuechunli$ mkdir liyc_hello localhost:Desktop yuechunli$ cd liyc_hello/初始化
localhost:liyc_hello yuechunli$ 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創建index.js--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: (liyc_hello) version: (1.0.0) description: entry point: (index.js) test command: git repository: keywords: author: license: (ISC) About to write to /Users/liyuechun/Desktop/liyc_hello/package.json: { "name": "liyc_hello", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "", "license": "ISC" } Is this ok? (yes) localhost:liyc_hello yuechunli$
function print_liyc_hello(name) { console.log(name); } exports.print_liyc_hello = print_liyc_hello;新建測試文件test.js
var fn = require("./index.js"); fn.print_liyc_hello("大家好,我是春哥,我的電話是13331184066");執行test
localhost:liyc_hello yuechunli$ pwd /Users/liyuechun/Desktop/liyc_hello localhost:liyc_hello yuechunli$ ls index.js package.json test.js localhost:liyc_hello yuechunli$ node test 大家好,我是春哥,我的電話是13331184066 localhost:liyc_hello yuechunli$發布到NPM 去官網注冊一個自己的開發賬號
到https://www.npmjs.com注冊賬號,記住自己的賬號,密碼,郵箱。
命令行連接NPMlocalhost:liyc_hello yuechunli$ npm adduser Username: liyuechun Password: Email: (this IS public) liyuechun2009@163.com Logged in as liyuechun on https://registry.npmjs.org/. localhost:liyc_hello yuechunli$ npm whoami liyuechun localhost:liyc_hello yuechunli$發布
localhost:liyc_hello yuechunli$ npm publish + liyc_hello@1.0.0 localhost:liyc_hello yuechunli$使用 創建React 項目
localhost:Desktop yuechunli$ mkdir liycDemo localhost:Desktop yuechunli$ cd liycDemo/ localhost:liycDemo yuechunli$ create-react-app testApp Creating a new React app in /Users/liyuechun/Desktop/liycDemo/testApp. Installing packages. This might take a couple minutes. Installing react-scripts... npm WARN prefer global marked@0.3.6 should be installed with -g > fsevents@1.0.17 install /Users/liyuechun/Desktop/liycDemo/testApp/node_modules/fsevents > node-pre-gyp install --fallback-to-build [fsevents] Success: "/Users/liyuechun/Desktop/liycDemo/testApp/node_modules/fsevents/lib/binding/Release/node-v51-darwin-x64/fse.node" is installed via remote testApp@0.1.0 /Users/liyuechun/Desktop/liycDemo/testApp └─┬ react-scripts@0.9.2 ├─┬ autoprefixer@6.7.2 │ ├─┬ browserslist@1.7.5 │ │ └── electron-to-chromium@1.2.4 │ ├── caniuse-db@1.0.30000628 │ ├── normalize-range@0.1.2 │ ├── num2fraction@1.2.2 │ ├─┬ postcss@5.2.15 │ │ └── js-base64@2.1.9 │ └── postcss-value-parser@3.3.0 Success! Created testApp at /Users/liyuechun/Desktop/liycDemo/testApp Inside that directory, you can run several commands: npm start Starts the development server. npm run build Bundles the app into static files for production. npm test Starts the test runner. npm run eject Removes this tool and copies build dependencies, configuration files and scripts into the app directory. If you do this, you can’t go back! We suggest that you begin by typing: cd testApp npm start Happy hacking!項目結構圖 安裝 liyc_hello
localhost:liycDemo yuechunli$ ls testApp localhost:liycDemo yuechunli$ cd testApp/ localhost:testApp yuechunli$ atom ./ localhost:testApp yuechunli$ npm install --save liyc_hello testApp@0.1.0 /Users/liyuechun/Desktop/liycDemo/testApp └── liyc_hello@1.0.0 localhost:testApp yuechunli$安裝后package.json內容變化 聯系我
微信&微信: 13331184066
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/83818.html
摘要:你只要算好各種食材的比例,不用關心做菜的過程,就是那個微波爐。項目搭建步驟官網官網開發環境安裝配置項目配置如圖所示運行項目開發編譯在瀏覽器輸入看到,就跑通了。從基礎開始,循序漸進,含有常用實戰項目,貼近企業真實現狀。 用一個完成的Vue系列文章,讓大家全面理解Vue的實現原理,掌握實用技巧,能在實戰中使用Vue,解鎖一個開發技能。文末有文章大綱請查看。不墨跡了!馬上寫內容: 1.為什...
摘要:下載地址安裝一個好用的命令行工具在環境下,系統默認的非常難用,所以我個人比較推薦大家使用或者。下載地址安裝在命令行工具中使用查看版本的方式確保與都安裝好之后,我們就可以安裝了。前端基礎進階系列目錄 showImg(https://segmentfault.com/img/remote/1460000009654403?w=1240&h=272); 對于新人朋友來說,想要自己去搞定一個E...
摘要:在終端中使用可以自動創建這個文件輸入這個命令后,終端會問你一系列問題。百度后發現引入了模式,有三個狀態,開發模式生產模式無。 什么是webpack,為什么要使用webapck * 導語 之前一直忙著項目,沒時間整理自己的東西,最近剛好發現自己對webpack又如此陌生了,于是整理了一篇關于webpack初探的干貨,這里是一點簡單的webpack配置 為什么使用webpck 現今很多網頁...
摘要:這些特性不僅帶來了大的性能提升,還減少多線程程序設計的復雜性,進而提高了開發效率。由公司建立的云計算平臺率先支持了。 前言 本文章主要寫給那些想了解node語言的開發,我的目標希望大家通過閱讀本篇文章能夠簡單使用node進行開發,以及了解一些事件驅動的異步編程風格,主要分node的背景,安裝配置,模塊創建引用等幾個方面描述 建議大家在閱讀本篇文章途中 可以親自嘗試一下我所帶來的小例子,...
閱讀 2474·2021-11-16 11:45
閱讀 2444·2021-10-11 10:59
閱讀 2251·2021-10-08 10:05
閱讀 3817·2021-09-23 11:30
閱讀 2370·2021-09-07 09:58
閱讀 790·2019-08-30 15:55
閱讀 773·2019-08-30 15:53
閱讀 1923·2019-08-29 17:00