It appears that npm install
is not adding files to node_modules/.bin
TL;DR:: My package depends on npm-run-all
and eslint
, etc. I should have node_modules/.bin/run-s
and node_modules/.bin/eslint
after running npm install
, but I don’t. Why not?
Here’s my config:
stages:
- install
- test
- deploy
cache:
key:
files:
- package-lock.json
- functions/package-lock.json
prefix: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules
- functions/node_modules
install:
image: node:latest
stage: install
before_script:
- npm install --unsafe-perm
- npm install --unsafe-perm --prefix functions
script:
- pwd
- ls node_modules/.bin
test:
image: buildkite/puppeteer:latest
stage: test
environment: staging
script:
- pwd
- npm run lint
- npm run test
# etc
And here’s the output for pwd
and ls node_modules/.bin
$ pwd
/builds/bennyp/project-name
$ ls node_modules/.bin
atob
is-ci
patch-package
pbjs
pbts
rc
semver
which
window-size
which of course causes the next stage to crash with
$ pwd
/builds/bennyp/project-name
$ npm run lint
> project-name@1.0.0 lint /builds/bennyp/project-name
> run-s lint:*
sh: 1: run-s: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! project-name@1.0.0 lint: `run-s lint:*`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the project-name@1.0.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-02-15T21_05_07_089Z-debug.log
Excerpts from package.json
"dependencies": {
"firebase": "^7.8.2"
},
"devDependencies": {
"eslint": "^6.8.0",
"npm-run-all": "^4.1.5",
"patch-package": "^6.2.0",
"rollup": "^1.31.1"
},
"scripts": {
"build": "run-s build:*",
"clean": "run-s clean:*",
"lint": "run-s lint:*",
"start": "run-p start:*",
"test": "run-s test:*",
"watch": "rollup -cw",
"build:client": "rollup -c",
"build:functions": "npm run build --prefix functions",
"clean:client": "rm -rf build",
"clean:functions": "rm -rf functions/build",
"lint:client": "eslint src/**/*.ts",
"lint:functions": "npm run lint --prefix functions",
"start:firebase": "firebase serve",
"start:watch": "rollup -cw",
"test:client:watch": "karma start --auto-watch=true --single-run=false",
"test:client": "karma start --coverage",
"test:functions": "npm run test --prefix functions",
"postinstall": "patch-package",
"update": "npm-check -u"
},
What is going on here?