Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

pipeline used to build, now fails, what changed? npm install -g yarn produces error code: EExist Edited

Normally my first step in my pipeline (.yml) file would be:

npm install -g yarn

This has worked fine up until and including yesterday, but today produces this error: 

+ npm install -g yarn
npm ERR! code EEXIST
npm ERR! syscall symlinknpm ERR! path ../lib/node_modules/yarn/bin/yarn.js
npm ERR! dest /usr/local/bin/yarn
npm ERR! errno -17npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn'
npm ERR! File exists: /usr/local/bin/yarn
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-12-19T09_14_51_680Z-debug.log

As far as I know I haven't changed anything else - I am re-running an existing pipeline, which ran fine yesterday.  Any ideas what is happening here?  Log is below...

+ cat /root/.npm/_logs/*-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',1 verbose cli '/usr/local/bin/npm',1 verbose cli 'install',
1 verbose cli '-g',1 verbose cli 'yarn' ]
2 info using npm@6.13.4
3 info using node@v10.18.0
4 verbose npm-session fafe9701af5a68cf
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 125ms
8 silly pacote tag manifest for yarn@latest fetched in 148ms
9 timing stage:loadCurrentTree Completed in 175ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 3ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule yarn@1.21.1 checking installable status
17 timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 6ms
18 timing stage:loadIdealTree Completed in 14ms
19 silly currentTree lib20 silly idealTree lib
20 silly idealTree `-- yarn@1.21.1
21 silly install generateActionsToTake
22 timing stage:generateActionsToTake Completed in 3ms
23 silly diffTrees action count 1
24 silly diffTrees add yarn@1.21.1
25 silly decomposeActions action count 8
26 silly decomposeActions fetch yarn@1.21.1
27 silly decomposeActions extract yarn@1.21.1
28 silly decomposeActions preinstall yarn@1.21.1
29 silly decomposeActions build yarn@1.21.1
30 silly decomposeActions install yarn@1.21.1
31 silly decomposeActions postinstall yarn@1.21.1
32 silly decomposeActions finalize yarn@1.21.1
33 silly decomposeActions refresh-package-json yarn@1.21.1
34 silly install executeActions
35 silly doSerial global-install 8
36 verbose correctMkdir /root/.npm/_locks correctMkdir not in flight; initializing
37 verbose lock using /root/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
38 silly doParallel extract 1
39 silly extract yarn@1.21.1
40 silly tarball trying yarn@latest by hash: sha512-dQgmJv676X/NQczpbiDtc2hsE/pppGDJAzwlRiADMTvFzYbdxPj2WO4PcNyriSt2c4jsCMpt8UFRKHUozt21GQ==
41 silly tarball no local data for yarn@latest. Extracting by manifest.
42 http fetch GET 200 234ms
43 silly extract yarn@latest extracted to /usr/local/lib/node_modules/.staging/yarn-53412bb0 (249ms)
44 timing action:extract Completed in 252ms
45 silly doReverseSerial unbuild 8
46 silly doSerial remove 8
47 silly doSerial move 8
48 silly doSerial finalize 8
49 silly finalize /usr/local/lib/node_modules/yarn
50 timing action:finalize Completed in 8ms
51 silly doParallel refresh-package-json 1
52 silly refresh-package-json /usr/local/lib/node_modules/yarn
53 timing action:refresh-package-json Completed in 33ms
54 silly doParallel preinstall 1
55 silly preinstall yarn@1.21.1
56 info lifecycle yarn@1.21.1~preinstall: yarn@1.21.1
57 timing action:preinstall Completed in 2ms
58 silly doSerial build 8
59 silly build yarn@1.21.1
60 info linkStuff yarn@1.21.1
61 silly linkStuff yarn@1.21.1 has /usr/local/lib/node_modules as its parent node_modules
62 silly linkStuff yarn@1.21.1 is part of a global install
63 silly linkStuff yarn@1.21.1 is installed into a global node_modules
64 silly linkStuff yarn@1.21.1 is installed into the top-level global node_modules65 verbose linkBins [ { yarn: 'bin/yarn.js', yarnpkg: 'bin/yarn.js' },
65 verbose linkBins '/usr/local/bin',65 verbose linkBins true ]66 verbose gently link refusing to delete existing link { link: '/usr/local/bin/yarn',
66 verbose gently link currentTarget: '/opt/yarn-v1.21.1/bin/yarnpkg',
66 verbose gently link newTarget: '/usr/local/lib/node_modules/yarn/bin/yarn.js',
66 verbose gently link gently: '/usr/local/lib/node_modules/yarn' }
67 verbose gently link refusing to delete existing link { link: '/usr/local/bin/yarnpkg',
67 verbose gently link currentTarget: '/opt/yarn-v1.21.1/bin/yarnpkg',67 verbose gently link newTarget: '/usr/local/lib/node_modules/yarn/bin/yarn.js',
67 verbose gently link gently: '/usr/local/lib/node_modules/yarn' }
68 timing action:build Completed in 7ms
69 verbose unlock done using /root/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
70 timing stage:rollbackFailedOptional Completed in 11ms
71 timing stage:runTopLevelLifecycles Completed in 518ms
72 verbose stack Error: EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn'
73 verbose cwd /opt/atlassian/pipelines/agent/build
74 verbose Linux 4.19.78-coreos
75 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "yarn"
76 verbose node v10.18.0
77 verbose npm v6.13.4
78 error code EEXIST
79 error syscall symlink
80 error path ../lib/node_modules/yarn/bin/yarn.js
81 error dest /usr/local/bin/yarn
82 error errno -1783 error EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn'
84 error File exists: /usr/local/bin/yarn
85 error Remove the existing file and try again, or run npm
86 error with --force to overwrite files recklessly.
87 verbose exit [ -17, true ]


1 answer

1 accepted

2 votes
Answer accepted

Turns out switching:

npm install -g yarn


 npm install yarn

was sufficient to resolve this problem.

I have not found out why it worked previously up until yesterday but now no longer works.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,826 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you