Sapper build failed

I am trying to run sapper as service, but build fails

Jan 20 07:15:20 PM ==> Running build command ‘yarn; yarn build’…
Jan 20 07:15:20 PM yarn install v1.22.5
Jan 20 07:15:20 PM warning package.json: No license field
Jan 20 07:15:20 PM info No lockfile found.
Jan 20 07:15:20 PM warning kupon7-fe@0.0.1: No license field
Jan 20 07:15:20 PM [1/4] Resolving packages…
Jan 20 07:15:24 PM warning node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
Jan 20 07:15:24 PM warning node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
Jan 20 07:15:24 PM warning node-sass > request > har-validator@5.1.5: this library is no longer supported
Jan 20 07:15:25 PM warning rollup > fsevents@2.1.3: “Please update to latest v2.3 or v2.2”
Jan 20 07:15:27 PM [2/4] Fetching packages…
Jan 20 07:15:40 PM info fsevents@2.1.3: The platform “linux” is incompatible with this module.
Jan 20 07:15:40 PM info “fsevents@2.1.3” is an optional dependency and failed compatibility check. Excluding it from installation.
Jan 20 07:15:40 PM [3/4] Linking dependencies…
Jan 20 07:15:40 PM [4/4] Building fresh packages…
Jan 20 07:15:40 PM success Saved lockfile.
Jan 20 07:15:40 PM Done in 20.34s.
Jan 20 07:15:41 PM yarn run v1.22.5
Jan 20 07:15:41 PM warning package.json: No license field
Jan 20 07:15:41 PM $ sapper build --legacy
Jan 20 07:15:41 PM /bin/sh: 1: sapper: not found
Jan 20 07:15:41 PM error Command failed with exit code 127.
Jan 20 07:15:41 PM info Visit …
Jan 20 07:15:41 PM ==> Build failed :disappointed:


I have also tried npx sapper build, but it also fails:

render@driftschool-sapper-shell:~/project/src$ npx sapper build
npx: installed 17 in 10.528s

Building…
Cannot find module ‘rollup’
Require stack:

  • /opt/render/project/src/@root
    Error: Cannot find module ‘rollup’
    Require stack:
  • /opt/render/project/src/@root
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at requireRelative (/opt/render/.cache/_npx/69/lib/node_modules/sapper/dist/create_manifest_data.js:246:15)
    at Function. (/opt/render/.cache/_npx/69/lib/node_modules/sapper/dist/create_manifest_data.js:4173:26)
    at Generator.next ()
    at /opt/render/.cache/_npx/69/lib/node_modules/sapper/dist/_commonjsHelpers.js:30:71
    at new Promise ()
    at Object.__awaiter (/opt/render/.cache/_npx/69/lib/node_modules/sapper/dist/_commonjsHelpers.js:26:12)
    at Function.load_config (/opt/render/.cache/_npx/69/lib/node_modules/sapper/dist/create_manifest_data.js:4171:33)
    render@driftschool-sapper-shell:~/project/src$

It is somehow possible to run sapper on render?

But when I tried to install sapper as static site, then build runs well.

Solved by using Docker image…

# Use the official lightweight Node.js 12 image.
# https://hub.docker.com/_/node
FROM node:12-slim

# Create and change to the app directory.
WORKDIR /usr/src/app

# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.

COPY / ./


# Install production dependencies.
RUN npm install

RUN npm run build

EXPOSE 8080

# Run the web service on container startup.
CMD [ "npm", "start" ]

Thanks for posting your solution @chosecz !