2014-10-10 141 views
-2

首先我安裝:爲什麼我不能安裝「快遞」?

lds-MacBook-Pro:~ ldnwty$ node --version 
v0.10.31 
lds-MacBook-Pro:~ ldnwty$ npm --version 
1.4.23 
lds-MacBook-Pro:~ ldnwty$ express --version 
4.8.0 

然後當我想安裝在我的項目明確:

lds-MacBook-Pro:contacts ldnwty$ npm install express 
npm WARN package.json [email protected] No description 
npm WARN package.json [email protected] No repository field. 
[email protected] ../../node_modules/express 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] ([email protected]) 
├── [email protected] ([email protected]) 
├── [email protected] ([email protected]) 
├── [email protected] ([email protected], [email protected]) 
├── [email protected] ([email protected], [email protected], [email protected]) 
├── [email protected] ([email protected]) 
└── [email protected] ([email protected], [email protected]) 

及其不能與「命令」安裝也。

我該怎麼辦?

+4

什麼讓你覺得它沒有安裝? – undefined 2014-10-10 14:30:34

+0

它沒有顯示在我的項目的本地文件夾時,當我做ls,theres沒有「node_modules」 - >表示 – 2014-10-10 14:33:03

回答

0

它已經安裝了(可能是全球範圍內,所以它是不是在你的應用程序的node_modules目錄),你應該能夠把它列入你的代碼如下:

var express = require('express'); 

如果你想更新它(因爲似乎有一個新版本),運行:

npm update 
+0

但爲什麼我不能在我的應用程序文件夾中看到此文件夾?當我將它安裝在本地應用程序文件夾中時,我需要看到「node_nodule」文件夾,不是嗎? – 2014-10-10 14:56:06

+0

它可以在全球範圍內安裝。然後它位於其他地方並可以通過您的所有Node應用程序訪問。你應該可以通過在你的'npm install'命令中添加'-g'來完成。 – Wouter0100 2014-10-10 14:59:10

+0

這是否回答了您的問題? :-) – Wouter0100 2014-10-11 12:28:49

相關問題