在IIS 7上部署Adonisjs 5服务器
我正在尝试在IIS上部署Adonisjs 5,我在RunningLog文件夹上遇到以下错误
。/runninglog
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Server\htdocs\Adonis\whatsapp\server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
这是我的web.config,我在其中使用为参数:c:\ server \ htdocs \ htdocs \ adonis \ adonis \ adonis \ whatsapp \ node_modules \ node_modules \ ts- ts- \ ts-ts- \ ts- \ ts- \ ts-ts--节点。\ server.ts 但是,我尝试在server.ts和server.js之间进行更改。 另外,我尝试使用ts节点无济于事,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httppPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\RunningLog\node.log" startupTimeLimit="20" processPath="C:\Program Files\nodejs\node.exe" arguments="C:\Server\htdocs\Adonis\whatsapp\node_modules\ts-node .\server.ts">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="Production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
这是我的软件包。
{
"name": "hello-world",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "node ace serve --watch",
"build": "node ace build --production",
"start": "node --experimental-specifier-resolution=node --loader ts-node/esm /server.ts",
"lint": "eslint . --ext=.ts",
"format": "prettier --write ."
},
"eslintConfig": {
"extends": [
"plugin:adonis/typescriptApp",
"prettier"
],
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": [
"error"
]
}
},
"eslintIgnore": [
"build"
],
"prettier": {
"trailingComma": "es5",
"semi": false,
"singleQuote": true,
"useTabs": false,
"quoteProps": "consistent",
"bracketSpacing": true,
"arrowParens": "always",
"printWidth": 100
},
"devDependencies": {
"@adonisjs/assembler": "^5.6.2",
"@japa/preset-adonis": "^1.0.15",
"@japa/runner": "^2.0.8",
"adonis-preset-ts": "^2.1.0",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-adonis": "^2.1.0",
"eslint-plugin-prettier": "^4.0.0",
"pino-pretty": "^7.6.1",
"prettier": "^2.6.2",
"typescript": "^4.6.4",
"youch": "^3.2.0",
"youch-terminal": "^2.1.4"
},
"dependencies": {
"@adonisjs/core": "^5.7.6",
"@adonisjs/repl": "^3.1.10",
"fs": "0.0.1-security",
"proxy-addr": "^2.0.7",
"qrcode-terminal": "^0.12.0",
"reflect-metadata": "^0.1.13",
"source-map-support": "^0.5.21",
"ts-node": "^10.7.0",
"whatsapp-web.js": "^1.16.6"
}
}
这是我的tsconfig.json
{
"extends": "./node_modules/adonis-preset-ts/tsconfig",
"include": ["**/*"],
"exclude": ["node_modules", "build"],
"compilerOptions": {
"esModuleInterop": true,
"outDir": "build",
"rootDir": "./",
"sourceMap": true,
"paths": {
"App/*": ["./app/*"],
"Config/*": ["./config/*"],
"Contracts/*": ["./contracts/*"],
"Database/*": ["./database/*"]
},
"types": ["@adonisjs/core", "@adonisjs/repl", "@japa/preset-adonis/build/adonis-typings"]
},
"ts-node": {
"esm": true
},
"lib": ["esnext"]
}
I am trying to deploy AdonisJS 5 on IIS, I am getting the following error on RunningLog folder
./RunningLog
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Server\htdocs\Adonis\whatsapp\server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
This is my web.config where I am using as arguments : C:\Server\htdocs\Adonis\whatsapp\node_modules\ts-node .\server.ts
However I have tried to play around changing between server.ts and server.js
Also I have tried to use ts-node to no avail
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httppPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\RunningLog\node.log" startupTimeLimit="20" processPath="C:\Program Files\nodejs\node.exe" arguments="C:\Server\htdocs\Adonis\whatsapp\node_modules\ts-node .\server.ts">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="Production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
This is my package.json
{
"name": "hello-world",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "node ace serve --watch",
"build": "node ace build --production",
"start": "node --experimental-specifier-resolution=node --loader ts-node/esm /server.ts",
"lint": "eslint . --ext=.ts",
"format": "prettier --write ."
},
"eslintConfig": {
"extends": [
"plugin:adonis/typescriptApp",
"prettier"
],
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": [
"error"
]
}
},
"eslintIgnore": [
"build"
],
"prettier": {
"trailingComma": "es5",
"semi": false,
"singleQuote": true,
"useTabs": false,
"quoteProps": "consistent",
"bracketSpacing": true,
"arrowParens": "always",
"printWidth": 100
},
"devDependencies": {
"@adonisjs/assembler": "^5.6.2",
"@japa/preset-adonis": "^1.0.15",
"@japa/runner": "^2.0.8",
"adonis-preset-ts": "^2.1.0",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-adonis": "^2.1.0",
"eslint-plugin-prettier": "^4.0.0",
"pino-pretty": "^7.6.1",
"prettier": "^2.6.2",
"typescript": "^4.6.4",
"youch": "^3.2.0",
"youch-terminal": "^2.1.4"
},
"dependencies": {
"@adonisjs/core": "^5.7.6",
"@adonisjs/repl": "^3.1.10",
"fs": "0.0.1-security",
"proxy-addr": "^2.0.7",
"qrcode-terminal": "^0.12.0",
"reflect-metadata": "^0.1.13",
"source-map-support": "^0.5.21",
"ts-node": "^10.7.0",
"whatsapp-web.js": "^1.16.6"
}
}
This is my tsconfig.json
{
"extends": "./node_modules/adonis-preset-ts/tsconfig",
"include": ["**/*"],
"exclude": ["node_modules", "build"],
"compilerOptions": {
"esModuleInterop": true,
"outDir": "build",
"rootDir": "./",
"sourceMap": true,
"paths": {
"App/*": ["./app/*"],
"Config/*": ["./config/*"],
"Contracts/*": ["./contracts/*"],
"Database/*": ["./database/*"]
},
"types": ["@adonisjs/core", "@adonisjs/repl", "@japa/preset-adonis/build/adonis-typings"]
},
"ts-node": {
"esm": true
},
"lib": ["esnext"]
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论