Commit 82fc55a4 authored by Kilian's avatar Kilian

Change npm dependencies install example

parent 6c11f394
......@@ -206,10 +206,15 @@ templates](https://gitlab.com/gitlab-org/gitlab-foss/tree/master/lib/gitlab/ci/t
### Caching Node.js dependencies
Assuming your project is using [npm](https://www.npmjs.com/) or
[Yarn](https://classic.yarnpkg.com/en/) to install the Node.js dependencies, the
following example defines `cache` globally so that all jobs inherit it.
Node.js modules are installed in `node_modules/` and are cached per-branch:
Assuming your project is using [npm](https://www.npmjs.com/)
to install the Node.js dependencies.
TIP: **Tip:**
By default, npm stores cache data in the home folder `~/.npm`
but [you can't cache things outside of the project directory](../yaml/README.md#cachepaths) so we simply tell npm to use `./.npm` instead.
The following example defines `cache` globally so that all jobs inherit it.
The npm cache is defined under `.npm/` and is cached per-branch:
```yaml
#
......@@ -221,10 +226,10 @@ image: node:latest
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .npm/
before_script:
- npm install
- npm ci --cache .npm --prefer-offline
test_async:
script:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment