Home > front end >  Nodejs with PKG packaged into exe start after normal but access error
Nodejs with PKG packaged into exe start after normal but access error

Time:12-17

Nodejs with PKG packaged into exe start after normal but when accessing a web page has an error:

 * * * * * * service is open * * * * * * 
C: \ snapshot \ PanshLicense \ public \ login HTML
{the Error: the File 'C: \ \ * * PanshLicense \ public \ login HTML' was not included into the executable at compilation stage. Both Please recompile adding it as asset or script.
The at error_ENOENT (PKG/prelude/bootstrap. Js: 426:17)
The at readFileFromSnapshot (PKG/prelude/bootstrap. Js: 654:29)
At the Object. The fs. ReadFile (PKG/prelude/bootstrap. Js: 721:5)
At app. Get (C: \ snapshot \ PanshLicense \ app js: 0-0)
At Layer. Handle [as handle_request] (C: \ snapshot \ PanshLicense \ node_modules \ express \ lib \ router \ Layer js: 95:5)
At next (C: \ snapshot \ PanshLicense \ node_modules \ express \ lib \ router \ route js: 137:13)
At the Route. Dispatch (C: \ snapshot \ PanshLicense \ node_modules \ express \ lib \ router \ Route js: 112:3)
At Layer. Handle [as handle_request] (C: \ snapshot \ PanshLicense \ node_modules \ express \ lib \ router \ Layer js: 95:5)
At C: \ snapshot \ PanshLicense \ node_modules \ express \ lib \ router \ index js: 281:22
Ats Function. Process_params (C: \ snapshot \ PanshLicense \ node_modules \ express \ lib \ router \ index js: 335:12)
Errno: - 4058,
Code: 'ENOENT,
Path: 'C: \ \ the snapshot \ \ PanshLicense \ \ public \ \ login HTML',
PKG: true}



Package. Json is configured to:
 
{
"Name" : "test",
"Version" : "1.0.0",
"Dependencies" : {
"Cors" : "^ 2.8.5,"
"Dialog - node", "^ 0.2.1",
"Express", "^ 4.17.1,"
"Ipc" : "0.0.1,"
"Md5 - node" : "^" 1.0.1,
Mime: "^ 2.4.6,"
"Multer" : "^ 1.4.2,"
"The node - Windows", "^ 1.0.0 - beta. 5"
},
"Bin" : "./app. Js ",
"PKG" : {
"Scripts" : [
"Public/js/*. Js,"
"Public/*. HTML
],
"Assets" : [
"Public/* */*,"
"Public/*. HTML
]
},
"DevDependencies" : {
"PKG" : "^ 4.4.9"
}
}


App. Js into login page written as follows, the normal boot is no problem

/
/login pageApp. Get ('/', (the req, res)=& gt; {
//get the user's request path
Let the pathname=url. Parse (the req. Url). The pathname.
The pathname pathname===='/'? '/login. HTML: the pathname;
//the user's request path into the actual server hard disk path
Let realPath=path. Join (__dirname, 'public' + pathname).
The console. The log (realPath)
Let type=mime. GetType (realPath)
//read the file
Fs. ReadFile (realPath (error, the result)=& gt; {
//if the file is read failure
If (error!=null) {
The console. The log (error)
Res. WriteHead (404, {
'the content-type' : 'text/HTML. Charset=utf8 '
})
Res. The end (' login file read failure);
return;
}
Res. WriteHead (200, {
'the content-type: type
})
Res. End (result);
});
});


Packaging: PKG -t node8 - win app. Js

If I pack is: PKG -t node8 - win package. Json error when packaging:
 
C: \ ProjectFile \ PanshLicense> PKG -t node8 - win package. Json
[email protected]
Error! TypeError: license. ToLowerCase is not a function
The at isPublic (C: \ ProjectFile \ PanshLicense \ node_modules \ _pkg @ 4.4.9 @ PKG \ lib - es5 \ walker. Js: 57:21)
At C: \ ProjectFile \ PanshLicense \ node_modules \ _pkg @ 4.4.9 @ PKG \ lib - es5 \ walker. Js: 322:23
At the Generator. Next (& lt; anonymous>)
At asyncGeneratorStep (C: \ ProjectFile \ PanshLicense \ node_modules \ _ @ [email protected] @ @ Babel \ runtime \ helpers \ asyncToGenerator js: 3:24)
At _next (C: \ ProjectFile \ PanshLicense \ node_modules \ _ @ [email protected] @ @ Babel \ runtime \ helpers \ asyncToGenerator js: they burnt)

Pray god give directions!
  • Related