[Bug] External dependencies from node_modules not being resolved
Hello.
First of all, thank you for your amazing work. I'm using version 7.0.0 of this library in my own .NET 8 library, and I've run into an issue. I have a node_modules folder with axios installed inside it. I am running the program from the same folder that contains the node_modules folder, and I'm using StaticNodeJSService.InvokeFromStringAsync<T> to run this script:
module.exports = async () => {
const axios = require('axios');
await axios.get('https://example.com');
console.log("OK");
};
I always get axios is not defined. I even tried to Configure<NodeJSProcessOptions> and set the ProjectPath or the NODE_PATH environment variable, but it didn't help.
I'm using node v20.11.1 and npm 10.2.4
Hi
I have no issue with that. But I use InvokeFromFileAsync instead of InvokeFromStringAsync:
_nodeJSService.InvokeFromFileAsync<string>("getTimeZone.js", "getTimeZone", args: new[] { latitude.ToString(), longitude.ToString() });
and my folder:
getTimeZone.js:
And my path setting:
builder.Services.AddNodeJS(); string path = Path.Combine(builder.Configuration.GetValue<string>(WebHostDefaults.ContentRootKey), "nodejs"); builder.Services.Configure<NodeJSProcessOptions>(options => options.ProjectPath = path);
And it's works Hope it's help
Hi I have no issue with that. But I use InvokeFromFileAsync instead of InvokeFromStringAsync:
Hello.
This is exactly the issue I'm facing. It works fine with InvokeFromFileAsync but my project requires the use of InvokeFromStringAsync.