Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Globally installed NPM packages missing. #781

Open
DeveloperC286 opened this issue May 19, 2022 · 0 comments
Open

Globally installed NPM packages missing. #781

DeveloperC286 opened this issue May 19, 2022 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@DeveloperC286
Copy link

Describe the bug

Packages such as Elm globally installed via NPM are not accessible within the build image.

https://github.com/netlify/build-image/blob/focal/Dockerfile#L230

E.g.

5:43:37 PM: $ npm list -g && ls $(npm root -g) && elm --version
5:43:38 PM: /opt/buildhome/.nvm/versions/node/v16.15.0/lib
5:43:38 PM: ├── corepack@0.10.0
5:43:38 PM: └── npm@8.5.5
5:43:38 PM: corepack
5:43:38 PM: npm
5:43:38 PM: bash: elm: command not found

To Reproduce

Steps to reproduce the behavior:

  1. Use the build image Ubuntu Focal 20.04 (default) on netlify.com.

Expected behavior

That Elm and other globally installed NPM packages can be used within the build image.

Build Output

5:43:27 PM: Build ready to start
5:43:29 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
5:43:29 PM: build-image tag: v4.8.0
5:43:29 PM: buildbot version: e694672a8289170fbd4455b79b331a0620566215
5:43:29 PM: Fetching cached dependencies
5:43:29 PM: Failed to fetch cache, continuing with build
5:43:29 PM: Starting to prepare the repo for build
5:43:29 PM: No cached dependencies found. Cloning fresh repo
5:43:29 PM: git clone git@gitlab.com:DeveloperC/netlify-elm-test
5:43:30 PM: Preparing Git Reference refs/heads/main
5:43:30 PM: Parsing package.json dependencies
5:43:31 PM: Starting build script
5:43:31 PM: Installing dependencies
5:43:31 PM: Python version set to 2.7
5:43:32 PM: Downloading and installing node v16.15.0...
5:43:32 PM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz...
5:43:32 PM: Computing checksum with sha256sum
5:43:32 PM: Checksums matched!
5:43:35 PM: Now using node v16.15.0 (npm v8.5.5)
5:43:35 PM: Started restoring cached build plugins
5:43:35 PM: Finished restoring cached build plugins
5:43:35 PM: Attempting ruby version 2.7.2, read from environment
5:43:36 PM: Using ruby version 2.7.2
5:43:36 PM: Using PHP version 8.0
5:43:36 PM: Started restoring cached go cache
5:43:36 PM: Finished restoring cached go cache
5:43:36 PM: go version go1.16.5 linux/amd64
5:43:36 PM: go version go1.16.5 linux/amd64
5:43:36 PM: Installing missing commands
5:43:36 PM: Verify run directory
5:43:37 PM: ​
5:43:37 PM: ────────────────────────────────────────────────────────────────
5:43:37 PM:   Netlify Build                                                 
5:43:37 PM: ────────────────────────────────────────────────────────────────
5:43:37 PM: ​
5:43:37 PM: ❯ Version
5:43:37 PM:   @netlify/build 27.1.2
5:43:37 PM: ​
5:43:37 PM: ❯ Flags
5:43:37 PM:   baseRelDir: true
5:43:37 PM:   buildId: 628673af840d5707db707982
5:43:37 PM:   deployId: 628673af840d5707db707984
5:43:37 PM: ​
5:43:37 PM: ❯ Current directory
5:43:37 PM:   /opt/build/repo
5:43:37 PM: ​
5:43:37 PM: ❯ Config file
5:43:37 PM:   No config file was defined: using default values.
5:43:37 PM: ​
5:43:37 PM: ❯ Context
5:43:37 PM:   production
5:43:37 PM: ​
5:43:37 PM: ────────────────────────────────────────────────────────────────
5:43:37 PM:   1. Build command from Netlify app                             
5:43:37 PM: ────────────────────────────────────────────────────────────────
5:43:37 PM: ​
5:43:37 PM: $ npm list -g && ls $(npm root -g) && elm --version
5:43:38 PM: /opt/buildhome/.nvm/versions/node/v16.15.0/lib
5:43:38 PM: ├── corepack@0.10.0
5:43:38 PM: └── npm@8.5.5
5:43:38 PM: corepack
5:43:38 PM: npm
5:43:38 PM: bash: elm: command not found
5:43:38 PM: ​
5:43:38 PM: ────────────────────────────────────────────────────────────────
5:43:38 PM:   "build.command" failed                                        
5:43:38 PM: ────────────────────────────────────────────────────────────────
5:43:38 PM: ​
5:43:38 PM:   Error message
5:43:38 PM:   Command failed with exit code 127: npm list -g && ls $(npm root -g) && elm --version (https://ntl.fyi/exit-code-127)
5:43:38 PM: ​
5:43:38 PM:   Error location
5:43:38 PM:   In Build command from Netlify app:
5:43:38 PM:   npm list -g && ls $(npm root -g) && elm --version
5:43:38 PM: ​
5:43:38 PM:   Resolved config
5:43:38 PM:   build:
5:43:38 PM:     command: npm list -g && ls $(npm root -g) && elm --version
5:43:38 PM:     commandOrigin: ui
5:43:38 PM:     publish: /opt/build/repo/build
5:43:38 PM:     publishOrigin: ui
5:43:39 PM: Caching artifacts
5:43:39 PM: Started saving build plugins
5:43:39 PM: Finished saving build plugins
5:43:39 PM: Started saving pip cache
5:43:39 PM: Finished saving pip cache
5:43:39 PM: Started saving emacs cask dependencies
5:43:39 PM: Finished saving emacs cask dependencies
5:43:39 PM: Started saving maven dependencies
5:43:39 PM: Finished saving maven dependencies
5:43:39 PM: Started saving boot dependencies
5:43:39 PM: Finished saving boot dependencies
5:43:39 PM: Started saving rust rustup cache
5:43:39 PM: Finished saving rust rustup cache
5:43:39 PM: Started saving go dependencies
5:43:39 PM: Finished saving go dependencies
5:43:40 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:43:40 PM: Creating deploy upload records
5:43:40 PM: Failing build: Failed to build site
5:43:40 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
5:43:40 PM: Finished processing build request in 11.725893335s```
@DeveloperC286 DeveloperC286 added the type: bug code to address defects in shipped code label May 19, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant