tag:support.appharbor.com,2010-11-23:/discussions/problems/82413-running-jspm-install-task-fails-unable-to-read-current-working-directoryAppHarbor: Discussion 2016-05-28T01:42:16Ztag:support.appharbor.com,2010-11-23:Comment/398997292016-05-17T11:01:37Z2016-05-17T12:56:22ZRunning "jspm install" task fails "Unable to read current working directory"<div><p>Hi,<br>
running "jspm install" command via MSBuild fails as mentioned</p>
<p>here's my configuration</p>
<p><br></p>
<pre>
<code><Exec Command="npm install jspm -g" />
<Message Text="Npm install jspm global finished" />
<Exec Command="npm install gulp -g" />
<Message Text="Npm install gulp global" />
<Exec Command="npm install typings@0.8.1 -g" />
<Message Text="Npm install typings global" />
<Exec Command="%USERPROFILE%\AppData\Roaming\npm\typings.cmd install" />
<Message Text="Typings Build Finished" />
<Exec Command="%USERPROFILE%\AppData\Roaming\npm\jspm.cmd install" />
<Message Text="JSPM Build Finished" /></code>
</pre>
<p>it fails with multiple errors, saying:</p>
<p>(NpmBuild target) -> EXEC : error : fatal: Unable to read
current working directory: No error
[D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj] EXEC :
error : fatal: Unable to read current working directory: No error
[D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj] EXEC :
error : fatal: Unable to read current working directory: No error
[D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj] EXEC :
error : fatal: Unable to read current working directory: No error
[D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj] EXEC :
error : fatal: Unable to read current working directory: No error
[D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj] EXEC :
error : fatal: Unable to read current working directory: No error
[D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj] EXEC :
error : fatal: Unable to read current working directory: No error
[D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj] EXEC :
error : fatal: Unable to read current working directory: No error
[D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj]
D:\temp\kmreogmz.via\input\XXXXX.Web\XXXXX.Web.csproj(397,5): error
MSB3073: The command "%USERPROFILE%\AppData\Roaming\npm\jspm.cmd
install" exited with code 1.</p></div>migajektag:support.appharbor.com,2010-11-23:Comment/398997292016-05-24T02:01:57Z2016-05-24T02:01:57ZRunning "jspm install" task fails "Unable to read current working directory"<div><p>Hi,</p>
<p>Apologies for the slow response. Did you figure this one out in
the meantime? I took a look at your apps and the only app with
recent builds that succeeded. If you resolved it and have time it'd
be great if you could share what the solution was (might be helpful
to others).</p>
<p>Otherwise let me know the name of the application and ideally a
link to a build failing with this error.</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/398997292016-05-24T07:04:06Z2016-05-24T07:04:06ZRunning "jspm install" task fails "Unable to read current working directory"<div><p>Hi Rune,</p>
<p>Thank you for the reply.<br>
I haven't solved the problem, what I did is a temporary (hopefully)
workaround - I've removed the "frontend" build steps from the
MSBuild, and instead deploy bundled files via git.</p>
<p>I've created a branch and an application to demonstrate the
problem, however this time the error is different (even though the
code is the same) - has anything changed in the build environment
in the meantime?</p>
<p>Here is the failing build<br>
<a href="https://appharbor.com/applications/nb-failing/builds/1748224">https://appharbor.com/applications/nb-failing/builds/1748224</a></p></div>migajektag:support.appharbor.com,2010-11-23:Comment/398997292016-05-25T04:00:37Z2016-05-25T04:00:37ZRunning "jspm install" task fails "Unable to read current working directory"<div><p>Hi again,</p>
<p>Yep the build servers was updated with a slightly newer version
of Git, which fortunately included more descriptive error messages
and revealed the underlying cause of this (and other related
npm/grunt/bower) related issues -- <a href="https://support.appharbor.com/discussions/problems/82415-resolve-bower-dependencies#comment_39951911">
take a look at my response in this thread</a> for a description of
the cause and a solution.</p>
<p>It should work for this issue as well, although you may have to
execute the NPM package script from a different directory (or
initialize the Git repository so it doesn't attempt to traverse the
directory structure beyond your user profile directory).</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/398997292016-05-27T20:10:51Z2016-05-27T20:10:51ZRunning "jspm install" task fails "Unable to read current working directory"<div><p>Hi Rune,<br>
thank you for the reply again.<br>
I've tried executing "git init" before npm/jspm install, however
had no luck again - the same "permission denied" error
appeared.</p>
<p>I'm trying to reproduce it locally, copied over my package.json
+ config.js (jspm dependencies) to a temporary directory (which is
not a git repo) and ran the same sequence as msbuild runs ... and
it all installed correctly.</p>
<p>I have no idea why would git try to traverse the directory tree
upward on the AppHb server ?</p></div>migajektag:support.appharbor.com,2010-11-23:Comment/398997292016-05-28T01:41:07Z2016-05-28T01:42:16ZRunning "jspm install" task fails "Unable to read current working directory"<div><p>Hi,</p>
<p>Ok sorry this is still causing you trouble. About the git
traversal: That's just how git works -- for instance, if you're in
a subdirectory of your git repository and execute <code>git
status</code> it'll still be able to identify that the subfolder is
a part of the git repository. Since there are no git files in
subfolders of a repository this can only work by traversing the
directory structure until a git repository folder
(<code>.git</code>) is found.</p>
<p>I took a look at some of the more recent builds on one of the
related applications. It looks like the git repository is being
initialized now, but the permission error is still there. That's
likely because the git repository is being initialized in the
temporary folder created for your builds, but the npm packages are
installed on under the user profile for the application.</p>
<p>You could try and remove the "-g" switch from the NPM install
commands so it's not installed globally. This should (or did, in
the other discussion I linked to) cause the packages to be
installed under the build context directory and address the git
traversal issue.</p>
<p>I'd admit that this is a bit of a hack and it's very likely that
there's a way to prevent npm from attempting to traverse
repositories or use git in this way. If you figure out a more
elegant way I'd love to hear what your solution is!</p>
<p>Best,<br>
Rune</p></div>rune