Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appmap-node command fails, presumably due to Windows path issue #122

Closed
kgilpin opened this issue Mar 2, 2024 · 11 comments · Fixed by #129
Closed

appmap-node command fails, presumably due to Windows path issue #122

kgilpin opened this issue Mar 2, 2024 · 11 comments · Fixed by #129
Assignees
Labels
bug Something isn't working released

Comments

@kgilpin
Copy link
Contributor

kgilpin commented Mar 2, 2024

Screenshot (33)

Screenshot (32)

@kgilpin kgilpin added the bug Something isn't working label Mar 2, 2024
@dividedmind
Copy link
Collaborator

Could this be related to a space in the user home directory path? Nb, I tried reproducing this by putting both appmap-node and the target project on a space-containing path on Linux, but it works for me. Perhaps there is something else going on or the problem is Windows-specific.

@dividedmind
Copy link
Collaborator

Another user saw this, they say they definitely didn't have a space in the path, so this must be something else. In case it's relevant, the OP was running Node 20.11.

@zermelo-wisen
Copy link
Collaborator

zermelo-wisen commented Mar 8, 2024

Steps to reproduce:

  • Set up a Windows environment (e.g., create a Windows VPS on AWS)
  • Create a user with a space in the user name: “John Doe”
  • Switch to the new user
  • Install Node to the default location
  • npm init a trivial project
  • Run npx app map-node rpm run test

This will result in the reported error:

image

It seems that the issue lies in the npm cache path, which contains a space from the username.

npm config get cache
C:\Users\John Doe\AppData\Local\npm-cache

To resolve this, eliminate the space in the npm cache path by using the 8-character version of the Windows user folder name. You can find out the 8-character user folder name with dir c:\users /x. For this example, John Doe becomes JOHNDO~1.

npm config set cache "C:\Users\Johndo~1\AppData\Local\npm-cache"

This should resolve the issue.

Similar issue is reported with different packages run with npx. Most relevant one is this: https://stackoverflow.com/questions/58354348/windows-10-npx-create-react-app-myapp-command-does-not-work-because-of-whit.

Additionally, you may encounter a different error before this one above, even if you don't have spaces in the user name:

image

The workaround for this is to create the $USERNAME\AppData\Roaming\npm folder manually. This is reported here: npm/cli#6971

@kgilpin
Copy link
Contributor Author

kgilpin commented Mar 8, 2024 via email

@dividedmind
Copy link
Collaborator

Seems like another workaround is to npm install -g npm@7: npm/cli#502

@dividedmind
Copy link
Collaborator

@zermelo-wisen, could you verify npm install -g npm@7 indeed fixes the problem?

@zermelo-wisen
Copy link
Collaborator

@zermelo-wisen, could you verify npm install -g npm@7 indeed fixes the problem?

I tried it, unfortunately not. npm@7 is an old version now anyway.

image

@dividedmind
Copy link
Collaborator

dividedmind commented Mar 16, 2024

@zermelo-wisen, could you verify npm install -g npm@7 indeed fixes the problem?

I tried it, unfortunately not. npm@7 is an old version now anyway.

Yeah, I suspected as much :/ Thanks for checking. Did you find a current bug report in npx for this issue? Because it seems npm/cli#502 is out of date.

@zermelo-wisen
Copy link
Collaborator

I checked the issues list, but couldn't find any.

@dividedmind
Copy link
Collaborator

It's actually our bug, I'm going to fix it.

dividedmind added a commit that referenced this issue Mar 18, 2024
This had a workaround but it turns out that it is in fact our bug.
Fixes #122
dividedmind added a commit that referenced this issue Mar 18, 2024
This had a workaround but it turns out that it is in fact our bug.
Fixes #122
dividedmind added a commit that referenced this issue Mar 19, 2024
This had a workaround but it turns out that it is in fact our bug.
Fixes #122
appland-release pushed a commit that referenced this issue Mar 19, 2024
# [2.19.0](v2.18.0...v2.19.0) (2024-03-19)

### Bug Fixes

* Correctly quote NODE_OPTIONS when spaces occur in paths ([36b5c9e](36b5c9e)), closes [#122](#122)

### Features

* Instrument named const and exported lambdas ([4ec7754](4ec7754))
* Stringify ClientRequests as `[ClientRequest: <method> <url>]` ([f4b8518](f4b8518))
@appland-release
Copy link

🎉 This issue has been resolved in version 2.19.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants