Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
82fc55a4
Commit
82fc55a4
authored
Feb 22, 2020
by
Kilian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change npm dependencies install example
parent
6c11f394
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
doc/ci/caching/index.md
doc/ci/caching/index.md
+11
-6
No files found.
doc/ci/caching/index.md
View file @
82fc55a4
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment