2016-08-26 147 views
0

我在這裏跟隨NativeScript教程:Nativescript找不到模塊「nativescript棱角/ HTTP」

Native Script Angular - Chapter 3

我有一個錯誤試圖導入nativescript-angular/http時。它說找不到模塊'nativescript-angular/http'。我錯過了什麼?我注意到在node_modules/native-script-angular/http.js下沒有http.js

enter image description here

任何幫助,將不勝感激。

+0

你嘗試安裝NPM包文件app.module.ts? – scokmen

+0

你好scokmen,不知道你是什麼意思,但我按照教程,通過NPM安裝了NativeScript。所以我猜npm包已經安裝好了,對吧? – PinoyCoder

+0

在您的項目的根目錄下運行'npm i'? –

回答

0

從您的雜貨文件夾中,您只需要運行以下命令來更新版本。

$ npm install -g npm-check-updates 
$ npm-check-updates -u 
$ npm install 

當的package.json更新下列它爲我工作

"dependencies": { 
"@angular/common": "2.0.0-rc.5", 
"@angular/compiler": "2.0.0-rc.5", 
"@angular/core": "2.0.0-rc.5", 
"@angular/http": "2.0.0-rc.5", 
"@angular/platform-browser": "2.0.0-rc.5", 
"@angular/platform-browser-dynamic": "2.0.0-rc.5", 
"@angular/platform-server": "2.0.0-rc.5", 
"@angular/router": "3.0.0-rc.1", 
"tns-core-modules": "2.2.1", 
"nativescript-angular": "0.3.1" 
}, 

如果你比較,你會看到NS _HTTP_PROVIDERS是當前的主內,但不在2.0.0版本是版本包括與樣品

https://github.com/NativeScript/nativescript-angular/blob/master/nativescript-angular/http/ns-http.ts

0

我有一個類似的問題。我所要做的就是在此之後刪除package-lock.json文件以及我的node_modules文件夾和npm install

0

您在接下來的 「NativeScriptHttpModule」 enter image description here