从bitbucket的Node.js应用程序azure色的部署
当我尝试从bitbucket部署nodejs应用程序时出现以下错误。
Command: "D:\home\site\deployments\tools\deploy.cmd" Handling node.js deployment. KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot' undefined:38 } ^ An error has occurred during web site deployment. SyntaxError: Unexpected token } in JSON at position 1090 at Object.parse (native) at Object.<anonymous> (D:\Program Files (x86)\SiteExtensions\Kudu\63.60712.2926\bin\Scripts\selectNodeVersion.js:179:44) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) undefined:38\r\n}\r\n^\r\n\r\nSyntaxError: Unexpected token } in JSON at position 1090\r\n at Object.parse (native)\r\n at Object.<anonymous> (D:\Program Files (x86)\SiteExtensions\Kudu\63.60712.2926\bin\Scripts\selectNodeVersion.js:179:44)\r\n at Module._compile (module.js:570:32)\r\n at Object.Module._extensions..js (module.js:579:10)\r\n at Module.load (module.js:487:32)\r\n at tryModuleLoad (module.js:446:12)\r\n at Function.Module._load (module.js:438:3)\r\n at Module.runMain (module.js:604:10)\r\n at run (bootstrap_node.js:394:7)\r\n at startup (bootstrap_node.js:149:9)\r\nD:\Program Files (x86)\SiteExtensions\Kudu\63.60712.2926\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
使用节点6.9.1
的package.json
{ "name": "example", "version": "1.0.0", "description": "REST APIs for example", "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", "url": "git+abc" }, "author": "abc", "license": "ISC", "homepage": "abc#readme", "dependencies": { "azure-storage": "^2.1.0", "body-parser": "^1.17.1", "change-case": "^3.0.1", "dateformat": "^2.0.0", "dotenv": "^4.0.0", "express": "^4.15.2", "jsonwebtoken": "^7.3.0", "minimist": "^1.2.0", "morgan": "^1.8.1", "mssql": "^4.0.1", "multer": "^1.3.0", "nconf": "^0.8.4", "node-friendly-response": "^3.1.4", "request": "^2.81.0", "require-dir": "^0.3.1", "swagger-node-express": "^2.1.3", "tedious": "^2.0.0", "tedious-promises": "^0.4.1", "underscore": "^1.8.3", "winston": "^2.3.1" } }
是因为我用过的节点模块吗?
还是在加载模块时出现问题?
看来你的package.json
不是一个有效的JSON。
更新:
Kudu使用以下代码来读取package.json
文件,请参阅selectNodeVersion.js的第179行。
json = existsSync(packageJson) && JSON.parse(fs.readFileSync(packageJson, 'utf8'));
因此,在将package.json
推送到github之前,可以使用下面的代码来validation本地文件:
var fs = require("fs"); var json = JSON.parse(fs.readFileSync("./package.json", 'utf8')); console.log(json);
例如,我在上面提供的package.json
的第38行添加了一个}
,我会得到和你一样的错误:
或者你可以使用命令npm install
来检查它:
- 将jQuery ajax调用转换为vanilla Javascript – 不能POST / public / error
- AssertionError:expected {Object(__flags)}有属性'_id'
- 如何将React.js / React Native Apps连接到Azure App Service的单个后端实例?
- mongoose在未指定的时间段后停止响应
- 如何在Javascript中使用承诺/链接与Azure移动服务自定义API
- 对MS Graph API的请求使我“授权请求被拒绝 – 没有足够的权限来完成操作”
- 删除Azure表存储中的大量条目
- 使用CSV批量上传到Azure存储
- Azure webapp node.js应用程序无法启动
- 使用Windows Azure,我可以使用Dropbox部署node.js服务器吗?
- Azure SDK – NodeJS – 重新上传blob时MD5散列值无效