When I try to open my Azure NodeJS React web app in Chrome, I get the following error:
PATH="$PATH:/home/site/wwwroot" npm start
ENOENT: no such file or directory, open '/home/site/wwwroot/package.json
This checks out when I examine the contents of /site/wwwroot in the Azure SSH:
_del_node_modules
asset-manifest.json
b
favicon.ico
index.html
logo192.png
logo512.png
manifest.json
oryx-appinsightsloader.js
package-lock.json
precache-manifest.6794c2e4defba13a31dcee7cae67859b.js
precache-manifest.705c77ad34ded94d21baca064fa569aa.js
precache-manifest.730dd540546e78da1c3ebb04036e733d.js
precache-manifest.9980bb9186e0ebd2771eff926887f432.js
precache-manifest.9a518a34a27fad9a357b7c78cdfbb7e8.js
precache-manifest.9c65ce33aab3813a0f162cf91b74c0f4.js
precache-manifest.ac183c8385a56a732a8286d5f2d8fa64.js
precache-manifest.b8756a719b957537ff5eb2ede103962d.js
precache-manifest.cbb7b5b3cc0bfbf94c161143ff651d3b.js
precache-manifest.e58827ccfca6115bc9268d09a7361ddd.js
robots.txt
service-worker.js
static
web.config
My build pipeline on Azure runs npm install and npm run build from the root directory, which is successful when run in VScode. The pipeline and release are successful. The outer structure of my directory tree in VScode looks like this:
├── README.md
├── node_modules
├── package-lock.json
├── package.json
├── public
├── schema.sql
├── server
└── src
So it seems like the npm run build is running successfully, creating a build folder that populates the /site/wwwroot folder. But Azure is expecting a package.json file. I tried running npm init in the public folder in VScode and also tried adding npm init to the Azure pipeline build tasks, but was getting the same error.
Also, not sure if this is related or not, but I added a web.config file in the public folder. When I look at that file in the Azure SSH, it looks like it can't be read properly:
/home/site/wwwroot/web.config: line 1: !--: No such file or directory
/home/site/wwwroot/web.config: line 2: $'\r': command not found
/home/site/wwwroot/web.config: line 3: ?xml: No such file or directory
/home/site/wwwroot/web.config: line 4: configuration: No such file or directory
/home/site/wwwroot/web.config: line 5: system.webServer: No such file or directory
/home/site/wwwroot/web.config: line 6: handlers: No such file or directory
/home/site/wwwroot/web.config: line 7: add: No such file or directory
/home/site/wwwroot/web.config: line 8: /handlers: No such file or directory
/home/site/wwwroot/web.config: line 9: rewrite: No such file or directory
/home/site/wwwroot/web.config: line 10: rules: No such file or directory
/home/site/wwwroot/web.config: line 11: rule: No such file or directory
/home/site/wwwroot/web.config: line 12: match: No such file or directory
/home/site/wwwroot/web.config: line 13: action: No such file or directory
/home/site/wwwroot/web.config: line 14: /rule: No such file or directory
/home/site/wwwroot/web.config: line 15: rule: No such file or directory
/home/site/wwwroot/web.config: line 16: match: No such file or directory
/home/site/wwwroot/web.config: line 17: conditions: No such file or directory
/home/site/wwwroot/web.config: line 18: add: No such file or directory
/home/site/wwwroot/web.config: line 19: add: No such file or directory
/home/site/wwwroot/web.config: line 20: add: No such file or directory
/home/site/wwwroot/web.config: line 21: /conditions: No such file or directory
/home/site/wwwroot/web.config: line 22: action: No such file or directory
/home/site/wwwroot/web.config: line 23: /rule: No such file or directory
/home/site/wwwroot/web.config: line 24: /rules: No such file or directory
/home/site/wwwroot/web.config: line 25: /rewrite: No such file or directory
/home/site/wwwroot/web.config: line 26: /system.webServer: No such file or directory
/home/site/wwwroot/web.config: line 27: syntax error near unexpected token `newline'
/home/site/wwwroot/web.config: line 27: `</configuration>'
Here's what it looks like in VScode:
<!-- tells azure to rewrite all urls as if they are pointing to root file-->
<?xml version="1.0"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="DynamicContent">
<match url="/*" />
<action type="Rewrite" url="index.js"/>
</rule>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I also encountered this problem (using windows). It was difficult to create the package.json - as it was not appearing after npm init. Preventing me from being able to install npm packages.
It helped me to:
type NUL > package.json
npm init -f
To get a actual valid package.json in place.
My problem was encountered creating a Functions App in the Azure Portal
Update:
Go to https://[yourappname].scm.azurewebsites.net/webssh/host and run npm install -g npm, and then run npm init command under home/site/wwwroot.
Original Answer:
Do you select Linux as the Web App's Operating System? I meet the similar problem on linux, but it doesn't occur on Windows OS.
In theory, there is no package.json, just use npm init to create it. I can operate smoothly on Windows OS, but not on Linux. I am investigating.
Related
I am using a WildFly(version - 19) to do file directory listing using below configuration.
<subsystem xmlns="urn:jboss:domain:undertow:10.0">
...
<host name="default-host" alias="localhost">
<location name="/SoftwareRepository" handler="SoftwareRepo"/>
</host>
...
<handlers>
<file name="SoftwareRepo" path = "<Path to Directory>" case-sensitive="false" directory-listing="true"/>
</handlers>
</subsystem>
This works fine for me and listing the file list for the respective configured path. B
Now, my worry is about authentication. The file directory listing is happening when I access the URL but without any authentication.
How to add any authentication mechanism to do this file handler?
I have a private C# project on the gitlab.com and want to create a NuGet package there.
I followed the instruction and created the following Nuget.config file on the solution level.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="gitlab" value="https://gitlab.com/api/v4/project/{my_project_numeric_id_here}/packages/nuget/index.json" />
</packageSources>
<packageSourceCredentials>
<gitlab>
<add key="Username" value="{my_username_in_gitlab}" />
<add key="ClearTextPassword" value="{my_personal_token_with_api_access_here}" />
</gitlab>
</packageSourceCredentials>
</configuration>
Then I used the Visual Studio Package Manager Console and ran the following command:
dotnet nuget push "C:\{path_to_the_package_here}\MyProject.1.0.0.nupkg" --source gitlab
and had the following error:
error: Unable to load the service index for source https://gitlab.com/api/v4/project/{my_project_numeric_id_here}/packages/nuget/index.json.
error: Response status code does not indicate success: 404 (Not Found).
MyProject.1.0.0.nupkg — exists.
Nuget.config — is seen by the command (reflects changes in the file).
Personal Token — I played with different permissions, at least api permission is granted, and all others too.
What is wrong in my actions and how to create a NuGet package from the C# project on GitLab.com?
I am trying to host a Flask Web app on a Windows Server 2012.
I have followed the instructions in http://developer.e-power.com.kh/publish-flask-on-iis/
At first it did not work but after enabling the HTTP Activation Windows Feature I was able to get the following error message after browsing http://localhost:80/ :
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 711, in main env, handler = read_wsgi_handler(response.physical_path)
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 568, in read_wsgi_handler return env, get_wsgi_handler(handler_name)
File "c:\inetpub\wwwroot\convnet\wfastcgi.py", line 551, in get_wsgi_handler raise ValueError('"%s" could not be imported' % handler_name)
ValueError: "app.app" could not be imported
StdOut:
StdErr:
The web.config file, which was automatically generated after following the instructions in the link above, is:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="FlaskHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python27\python.exe|c:\inetpub\wwwroot\convnet\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
Make sure you have app object is importable from app.py. Looks like it doesn't find it:
ValueError: "app.app" could not be imported
I have 2 projects running on my IIS under Default Website, project A & B. They have two different physical paths.
When i try to run project A i get this error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Helpers' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Source Error:
Line 27: <pages>
Line 28: <namespaces>
Line 29: <add namespace="System.Web.Helpers" />
Line 30: <add namespace="System.Web.Mvc" />
Line 31: <add namespace="System.Web.Mvc.Ajax" />
Source File: c:\inetpub\wwwroot\B\EnrollmentPortal\Web.config Line: 29
Project A tries to read the web.config of project B. How is this possible? I can't find any path from project A to project B, and no setting in IIS where you can specify a path to web.config.
How can i solve this?
E.g. when I add a new table it does not appear in the Northwind namespace untill I remove the project folder from :
C:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\
or add and readd the SubSonic.dll
I have the following configuration :
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic"></section>
....
<SubSonicService defaultProvider="Northwind">
<providers>
<clear/>
<add name="Northwind"
type="SubSonic.SqlDataProvider, SubSonic"
connectionStringName="Northwind"
generatedNamespace="Northwind"/>
</providers>
</SubSonicService>
<connectionStrings>
<add name="Northwind" connectionString="Data Source=.;Database=Northwind;Integrated Security=true;"/>
</connectionStrings>
....
<compilation debug="true">
<buildProviders>
<add extension=".abp" type="SubSonic.BuildProvider, SubSonic"/>
</buildProviders>
...
<pages>
<controls>
<add assembly="SubSonic" namespace="SubSonic" tagPrefix="subsonic"/>
The issue here is that the BuildProvider doesn't "go off" unless you change the abp file in App_Code. It's a hack, but if you want it to work you need to open that file up and change it somehow by adding a space or something - then it will kick off the builder.
I'm working on some T4 templates so you don't have to do this. Also - you can use our commandline tool to generate the stuff to file for you:
http://subsonicproject.com/subcommander/using-the-command-line-tool-subcommander/
Thanks, both worked !
Either as you said to simply change the *.abp file ( added couple of spaces)
or
sonic.exe generate /config "D:\path\to\my\web.config"
P.S.
I have a D:\temp\utils folder , where I keep all the command line tools used ... and it is part of the %PATH% environmental variable ...
and it took me couple of minutes to realize that I had to copy the whole :
D:\libs\orm\SubSonic_2.1_Final_Source\src\SubSonic\bin\Debug directory to that command line tools folder ...
Edit: Even faster with VS External Tool command :
Tools - External Tools - Add
Title: SubSonic
Command: D:\path\to\sonic.exe
Arguments: generate /config "D:\path\to\my\web.config"
Initial Directory: {$ProjectDir}
Tools - Options - Keyboard
Find tools Subsonic
for it to work from anywhere on the command line