-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
INodeServices IIS Node environment variable not found #12474
Comments
Thanks for contacting us, @atotalnoob. |
@atotalnoob do you plan to turn this into a PR for 2.1 docs? If not, this area got obsoleted (dotnet/aspnetcore#12890) so we will otherwise close this issue. |
No. And this should be documented. 2.1 is a LTS release. Also, removing nodeservices from .net is dumb |
I think that's reasonable. The doc update here sounds pretty straightforward - we just need to tell people how to get node onto the path when running on IIS. @scottaddie is this something you could help out with? @shirhatti could you please confirm that the steps suggested here are the best way to get node on the path for your app? |
Actually, shouldn't adding node to the system path resolve this issue? IIS apps run under specific locked down user accounts. @atotalnoob Did you try that and it didn't work? |
Putting it on system path did not work for me. |
@atotalnoob Got it - thx. @scottaddie We should investigate a bit what's going on here before documenting this. From what I understand using the system path should work. @shirhatti ? |
System path is still not ideal, what if you have multiple versions of node installed? |
Follow-up to what Dan said, System PATH will work. It mostly likely requires a reboot if didn't work for you. If you want to change an environment variable on a per ASP.NET Core application in ASP.NET Core you can set it in the <?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
<environmentVariables>
<environmentVariable name="PATH" value="..." />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration> |
I I did reboot multiple times. I tried setting it in the web.config. |
@scottaddie what doc does this belong in? Can you add meta-data to create an integrated issue? @wadepickett could add the instructions. |
@wadepickett Go ahead with adding the instructions. |
@scottaddie, thanks. Rick had asked what doc this belongs in. Is that no longer an open question? Put it in "Use JavaScript Services to Create Single Page Applications in ASP.NET Core" I assume then listed at the top? Also the "instruction" needed has resolved to simply using shirhatti's instruction of setting the system PATH in the web.config as the solution (and whatever intro to that needed). |
@wadepickett Yes, this goes in the JavaScript Services doc. The most natural place for the instruction is beneath the "Node.js (version 6 or later) with npm" bullet point in the Prerequisites for using SpaServices section. Maybe just add a bullet that says:
You might want to move this XML snippet to an external file so you can highlight the |
This comment has been minimized.
This comment has been minimized.
@mohamedeg97, I think it was fair to verify given atotalnoob indicated it did not fix the particular problem atotalnoob was experiencing, and that Rick had asked what doc this belonged in. You don't think so? I do agree it is easy and I felt awkward having to verify. |
Is your feature request related to a problem? Please describe.
I have an ASP.NET Core 2.1 application we recently integrated INodeServices into to run javascript. I installed NodeJS version 10.15.3-x64 onto the server using default installation.
My application runs on IIS 8/Windows Server 2012.
INodeServices worked fine on localhost and passed unit tests, so I pushed it to our unstable dev for further testing. It immediately failed, throwing an exception saying Node was not found in the path environment variable.
I checked the environment variable and it node was present, as well as node --version was working.
Describe the solution you'd like
I resolved this issue by doing this:
Configure Application Pool Identity
a. Right click on the application pool and select advanced settings
b. Under Process Model, set Load User Profile to True.
i. Recycle the application pool, then navigate to the webpage once to trigger the application pool identity creation
c. Note the Application Pool name
d. Open up Regedit
i. Locate HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist, find the identity name noted in C in the data column, located in the path \Device\HarddiskVolume1\Users\ApplicationPoolName
ii. Copy down the name, which should look like \Registry\User\S-1-5-82-3876422241-1344743610-1729199087-774402673-2621913236
iii. Locate that user in HKEY_USERS\
iv. Expand the key, find the environment key and select it
v. Under Name column, if there is a variable called PATH already, select it and add C:\Program Files\nodejs\
Otherwise, create a new entry by right clicking and selecting 'Expandable String Value'
Set the name to PATH and the data to C:\Program Files\nodejs\
I would like to have this documented somehwere to assist other developers with this problem.
Describe alternatives you've considered
Additional context
Add any other context or screenshots about the feature request here.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: