Giter Site home page Giter Site logo

Comments (5)

david-luna avatar david-luna commented on June 14, 2024

Hi @cmartineauOptimum,

basically what happens is that Yarn + pnpm is adding a custom loader for its cache under the hood. To do soo it sets the environment variable NODE_OPTIONS to a certain value.

The getting started guide assumes this var is not set so the npm scripts

"dev": "NODE_OPTIONS=--require=elastic-apm-node/start-next.js next dev"

overriding its value and making the yarn + pnpm loader unavailable.

You can change the script to append the required value into node options. This is an example

"dev": "NODE_OPTIONS=\"$NODE_OPTIONS --require=elastic-apm-node/start\" node next dev"

This will maintain reference to the required loaders and append the agent start script at the end.

Cheers!

from apm-agent-nodejs.

cmartineauOptimum avatar cmartineauOptimum commented on June 14, 2024

Hello @david-luna,

I have tried your suggestion and it did work in this repository with the nextjs example.

When it came to try it with my project, I had this error :

Error: Qualified path resolution failed: we looked for the following paths, but none could be accessed.

Source path: /workspace/next
Not found: /workspace/next

it seem it wasn't able to start next. I change your suggestion to

"dev": "NODE_OPTIONS=\"$NODE_OPTIONS --require=elastic-apm-node/start-next.js\" next dev "

This seem to be working. do you see any issue with the change I made ?

from apm-agent-nodejs.

david-luna avatar david-luna commented on June 14, 2024

do you see any issue with the change I made ?

Maybe we weren't using the same yarn + pnpm version and the resolution differs a little bit. It is okay to use the extension.

from apm-agent-nodejs.

david-luna avatar david-luna commented on June 14, 2024

Hi @cmartineauOptimum

As per your last comment in assume the issue is fixed. Should I proceed to close it?

from apm-agent-nodejs.

cmartineauOptimum avatar cmartineauOptimum commented on June 14, 2024

Yes, thank you

from apm-agent-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.