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

[BUG] NPM install applicationinsights fails with errno -4058 #1403

Closed
iamsamcoder opened this issue Dec 4, 2024 · 6 comments
Closed

[BUG] NPM install applicationinsights fails with errno -4058 #1403

iamsamcoder opened this issue Dec 4, 2024 · 6 comments
Assignees

Comments

@iamsamcoder
Copy link

I have a fresh install of node.js on Windows 11. I can install other packages, e.g. npm install axios, but I cannot install applicationinsights.

Steps to Reproduce

  • Fresh install of latest node.js on Windows 11.
  • Create project folder.
  • npm init
  • npm install applicationinsights fails with errno -4058. See full logs attached.

I also cannot create a new Express api project in VS2022. It fails with similar errors.

Expected behavior

Install applicationinsights to succeed.

VS2022 create Express app to successfully init the project.

Additional context

Log details:
Install applicationinsights logs 2024-12-04T20_09_41_187Z-debug-0.log

Create ExpressProject failure logs: 2024-12-04T20_26_05_979Z-debug-0.log

@MSNev
Copy link

MSNev commented Dec 10, 2024

Is this applicationinsights (which is actually the node SDK ) or applicationinsights-web -- this repo?

@MSNev
Copy link

MSNev commented Dec 10, 2024

Looking at the logs it looks like node... transferring

@MSNev MSNev transferred this issue from microsoft/ApplicationInsights-JS Dec 10, 2024
@JacksonWeber JacksonWeber self-assigned this Dec 11, 2024
@JacksonWeber
Copy link
Contributor

@iamsamcoder I cannot reproduce your results above on Node 23.4.0. Can you provide the exact node and npm versions you're using? And does clearing the node_modules and package.lock file and reinstalling the node modules produce any different results?

@iamsamcoder
Copy link
Author

Hi @JacksonWeber,

I have installed Node v22.12.0 and NPM 10.9.1. I tried clearing node_modules and package.lock. I also uninstalled and reinstalled node.

I got around this error my moving my project to Ubuntu on WSL and then application insights for node installed without issue (Node 22.3.0).

However, I would prefer not to have to use a WSL vm and I can't create a node.js project in VS 2022 on windows 11. Seems the issue was with installing azure packages. Axios installed fine on windows environment.

@JacksonWeber
Copy link
Contributor

@iamsamcoder are you able to install any other Azure packages? Or is application insights the only one giving you trouble? We can narrow it down from there. Although it's strange that I can't reproduce your issue, even in the same environment.

@iamsamcoder
Copy link
Author

I've found the problem. NPM install on windows required git bash for post install scripts. I just needed to add .npmrc file with path to git bash.
script-shell="C:\\Program Files\\Git\\bin\\bash.exe"

Now, I'm able to install app insights. However, I was able to install other Azure packages before the update to my .npmrc file. It seems app insights has a dependency on protobufjs, which required git bash for post install scripts.

I'm closing this ticket now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants