簡體   English   中英

無法運行 Salesforce trailhead 用戶界面 API Docker、Z3D945423F8E94B4460429 上的“安裝示例應用程序”。

[英]Unable to run Salesforce trailhead User Interface API “Install the Sample App” on Docker, Ubuntu 18.04

我在 Docker 上的 Ubuntu 18.04 機器上運行 Salesforce Trailhead 教程 - RecordViewer 應用程序時遇到問題。 Trailhead 教程可通過此鏈接獲得( https://trailhead.salesforce.com/en/content/learn/modules/user-interface-api/install-sample-app?trail_id=force_com_dev_intermediate

完整的 APP 代碼可在 git 的鏈接中獲得 - https://github.com/forcedotcom/RecordViewer

**此外,在全新安裝 Docker 18.09.9 版本后,該應用程序運行良好。 但是,當我重新啟動機器時,出現以下錯誤 - (

$ docker-compose build && docker-compose up -d
Building web
Step 1/7 : FROM node:8.9.3
 ---> 2eeae8debf3d
Step 2/7 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 6d3cbee274e4
Step 3/7 : COPY package*.json ./
 ---> Using cache
 ---> 8d4dc1aebcb8
Step 4/7 : RUN npm install
 ---> Running in 29f377439948
fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at Object.Module._extensions..js (module.js:645:20)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
ERROR: Service 'web' failed to build: The command '/bin/sh -c npm install' returned a non-zero code: 1

)

**RecordViewer 應用程序 - 是一個 nodejs,使用 salesforce 用戶界面 API 的反應應用程序

讓我解釋一下我做了什么——

  1. 我已經在我的機器上安裝了最新的 Docker 版本,但由於某些庫不兼容,無法運行該應用程序。

  2. 所以我在我的 ubuntu 機器上安裝了 docker 18.09.9 版本。 docker 已完美安裝並運行 hello-world 程序。

  3. 從項目目錄安裝和使用終端后,運行以下命令,應用程序運行良好 - $ docker-compose build && docker-compose up -d

  4. 當我重新啟動機器時,我無法運行該應用程序。

  5. 我嘗試了很多,到處搜索,但找不到解決方案。

下面是我機器上安裝的docker版本——

$ docker version
Client:
 Version:           18.09.9
 API version:       1.39
 Go version:        go1.11.13
 Git commit:        039a7df9ba
 Built:             Wed Sep  4 16:57:28 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.09.9
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.13.4
  Git commit:       9552f2b
  Built:            Sat Nov 16 01:07:48 2019
  OS/Arch:          linux/amd64
  Experimental:     false

這似乎是某種權限問題,但我已嘗試將所有權限授予當前用戶在 /usr/local/ 目錄上。

任何幫助都會很棒。

謝謝,布里吉

我不確定確切的問題,但認為這是某種許可問題。 我嘗試了很多對各種目錄的所有權限。 最后我的 ubuntu 崩潰了,出現了奇怪的黑屏。 我不得不在我的機器上重新安裝 Ubunut 18.04。 現在我按照 docker 網站上的安裝指南安裝了 docker 版本 19.03.11。 該項目使用命令 $ docker-compose build && docker-compose up -d 運行。

我按照下面提到的步驟 -

// installation link - https://docs.docker.com/engine/install/ubuntu/

$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

//add official key of docker
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

//as latest version was not working I install below version
//installing version - 5:18.09.9~3-0~ubuntu-bionic
$ sudo apt-get install docker-ce=5:18.09.9~3-0~ubuntu-bionic docker-ce-cli=5:18.09.9~3-0~ubuntu-bionic containerd.io

// Install Docker Compose.
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

// give executable rights
$ sudo chmod +x /usr/local/bin/docker-compose

//create a symbolic link to /usr/bin
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose


### Running Project trailhead ##
---------------------------------
// run the project from the folder
$ docker-compose build && docker-compose up -d
//if above command giving error
// add self user to docker group
$ usermod -aG docker ${USER}

// check status 
$ sudo systemctl status docker.service -l

// If still givving error then try this. 
$ docker-compose --verbose up

I got it running after following above steps.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM