[英]If I do an NPM install with “npm install --save-dev” how can I check for updates
[英]What does npm install --save express@4.10.2 mean and how do I use it?
我是Node.JS的新手(如果能幫助您進行任何比較,我的背景是Unity C#)。
我在Socket.IO的聊天教程中
http://socket.io/get-started/chat/
我不明白這是什么意思
First let’s create a package.json manifest file that describes our project.
I recommend you place it in a dedicated empty directory (I’ll call mine
chat-example).
{
"name": "socket-chat-example",
"version": "0.0.1",
"description": "my first socket.io app",
"dependencies": {}
}
Now, in order to easily populate the dependencies with the things we need, we’ll
npm install --save express@4.10.2
--save將依賴性添加到package.json文件。 例如,如果您有一個package.json,看起來像
{
"name": "shared",
"version": "1.0.0",
"description": "Webapp for XYZ",
"author": "Harsha Venkatram",
"license": "ISC"
}
然后你做npm install --save express
該package.json將成為
{
"name": "shared",
"version": "1.0.0",
"description": "Webapp for XYZ",
"author": "Harsha Venkatram",
"license": "ISC",
"dependencies": {
"express": "^4.14.0"
}
}
之后,您可以像這樣在節點服務器JS文件中使用express框架
import express from 'express'
我們可以使用npm install express
嗎,是的,我們絕對可以,並且在導入時仍然可以使用,不同之處在於,如果要將項目托管在服務器上,則必須在登錄服務器后再次執行npm install express
。 但是,如果您使用了--save
選項,則只需執行npm install
下載所有依賴項!
這是重復的問題: https : //stackoverflow.com/a/19578808/5410166
是的,它在安裝了nodejs和npm的計算機,服務器或開發計算機的終端上運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.