简体   繁体   中英

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

I am facing problem while running the Salesforce trailhead tutorial - RecordViewer app on my Ubuntu 18.04 machine on Docker. Trailhead tutorial is available the this link ( https://trailhead.salesforce.com/en/content/learn/modules/user-interface-api/install-sample-app?trail_id=force_com_dev_intermediate )

Complete APP code is available on git at link - https://github.com/forcedotcom/RecordViewer

**Also the app is running good after the fresh install of Docker 18.09.9 version. However, when i restart the machine, I am gettting the below error - (

$ 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 App - is a nodejs, react app using salesforce User Interface API

Let me explain what i did -

  1. I have installed the latest Docker version on my machine but due to some library incompatibality couldn't run the app.

  2. So I installed docker 18.09.9 version on my ubuntu machine. docker is installed perfectly and running the hello-world program.

  3. After installing and using terminal from the project directory run the below command and the app got running well- $ docker-compose build && docker-compose up -d

  4. When I restart the machine I am unable to run the App.

  5. I have tried alot, seached every where but could not find the solution.

Below is the docker version installed in my machine-

$ 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

It seems some sort of permission issue but i have tried giving all rights to current user on /usr/local/ directory.

Any help will be great.

Thanks, Brij

I am not sure about exact problem but think it was some sort of permission issue. I tried alot giving all permissions to various directories. Finally my ubuntu crashed giving wierd black screen. I had to reinstall Ubunut 18.04 in my machine. Now I have installed docker version 19.03.11 following the installation guide on docker website. the project run with the command $ docker-compose build && docker-compose up -d.

I followed the below mentioned steps-

// 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM