2017-06-18 142 views
0

我在Azure中創建一個Web應用程序。@ line/bot-sdk in azure not working

並從存儲庫中的bitbucket中進行部署。

但蔚藍總是給我這個錯誤

Error: Cannot find module '@line/bot-sdk' 

的package.json:

{ 
 
    "name": "linebot", 
 
    "version": "1.0.0", 
 
    "description": "", 
 
    "main": "index.js", 
 
    "dependencies": { 
 
    "@line/bot-sdk": "^2.0.0", 
 
    "body-parser": "^1.17.2", 
 
    "express": "^4.15.3", 
 
    "fs-extra": "^3.0.1" 
 
    }, 
 
    "devDependencies": {}, 
 
    "engines": { 
 
    "node": ">=6" 
 
    }, 
 
    "scripts": { 
 
    "start": "node index.js" 
 
    }, 
 
    "author": "", 
 
    "license": "ISC" 
 
}

回答

0

它看起來像 「@線/ BOT-SDK」 尚未安裝正常。首先,請確保package.josn位於存儲庫的根文件夾中。

enter image description here

一旦你把你的代碼到位桶,將庫同步到/site/wwwroot Azure上的應用服務,在這裏通過執行部署腳本運行npm install --production

:: 3. Install npm packages 
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
    pushd "%DEPLOYMENT_TARGET%" 
    call :ExecuteCmd !NPM_CMD! install --production 
    IF !ERRORLEVEL! NEQ 0 goto error 
    popd 
) 

最後,你可能要檢查的依賴他們是否已經通過應用服務編輯https://[YouAppName].scm.azurewebsites.net/dev/wwwroot/)已安裝。

enter image description here

+0

我輸入'LS node_modules'在蔚藍的控制檯窗口,我不能在裏面找「@line」文件夾中。但它確實存在於BitBucker回購中。 –