NPM modules cannot be found

Hi, I’m currently trying to evaluate drone:7.0 and having fought a bit with setup I now have gogs and drone communication nailed. However I cannot get a single build to complete. I cannot understand how to access build logs in the docker container but they all fail with similar output ({insert_npm_package_name}: not found).
Please see build output and config files below:

# build output
2 npm notice created a lockfile as package-lock.json. You should commit this file. 7s
3 npm WARN [email protected] requires a peer of [email protected]^2.1.0 but none is installed. You must install peer dependencies yourself.7s
4 7s
5 added 238 packages in 6.493s 7s
6 + npm run lint 7s
7 7s
8 > [email protected] lint /drone/src/gogs:3000/gogs/drone-test/compare/981a33cab4602a2224d793ecd87337ea1d43274c...f5f3e0b029dd1a816daf56f871924f5e06e3b159 7s
9 > eslint ./server 7s
10 7s
11 sh: 1: eslint: not found 7s
12 npm ERR! file sh 7s
13 npm ERR! code ELIFECYCLE 7s
14 npm ERR! errno ENOENT 7s
15 npm ERR! syscall spawn 7s
16 npm ERR! [email protected] lint: `eslint ./server` 7s
17 npm ERR! spawn ENOENT 7s
18 npm ERR!  7s
19 npm ERR! Failed at the [email protected] lint script. 7s
20 npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 7s
21 7s
22 npm ERR! A complete log of this run can be found in: 7s
23 npm ERR!     /root/.npm/_logs/2017-11-04T14_37_21_894Z-debug.log
# .drone.yml:
pipeline:
  build:
    image: node:latest
    commands:
      - npm install
      - npm run lint
      - npm run test
# package.json:
{
  "name": "drone-test",
  "version": "1.0.0",
  "description": "A quick test to understand how to do builds using drone.",
  "main": "index.js",
  "scripts": {
    "lint": "./node_modules/.bin/eslint ./server",
    "start": "nodemon server/index.js",
    "test": "./node_modules/.bin/mocha"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.18.2",
    "cors": "^2.8.4",
    "express": "^4.16.2",
    "method-override": "^2.3.10",
    "mongoose": "^4.12.3",
    "morgan": "^1.9.0"
  },
  "devDependencies": {
    "chai": "^4.1.2",
    "eslint": "^4.9.0",
    "mocha": "^4.0.1",
    "sinon": "^4.0.1",
    "sinon-mongoose": "^2.0.2"
  }
}

I’ve tried removing the paths to the node_modules/.bin directory in the npm script definitions but that makes no difference. It makes me think the working directory isn’t the root of the project. Can anyone offer some help please?

The issue is that your code is being cloned to a path with a colon:

/drone/src/gogs:3000/...

This can be solved by manually defining your clone path:

+workspace:
+  base: /drone
+  path: src

pipeline:
  build:
    image: node:latest
    commands:
      - npm install
      - npm run lint
      - npm run test

Note that this was a regression in drone 0.7 that was resolved with drone 0.8. So you could alternatively upgrade to 0.8, per these instructions http://docs.drone.io/release-0.8.0

Amazing! Can’t believe I missed that colon. :smiley:

Thanks so much for the quick response, it’s working great now. Will look into upgrading to drone 0.8, thanks for the tip.