[英]npm publish causes 'Error: EPERM: operation not permitted, unlink ...', errno -4048
[英]Using nodejs app as Windows Service causes EPERM-4048 ERROR
我正在使用“ node-windows ”來創建將在 Windows 上運行我的 app.js 服務器的服務。 這是制作服務的代碼(使用 node-windows 模塊)-
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'Demo Landing Page',
description: 'The nodejs.org example web server.',
script: 'app.js'
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
腳本一切正常,但這一行用於讀取目錄內容-
fs.readdir([PATH], function(err, builds)
這是我得到的錯誤 -
{Error: EPERM: operation not permitted, scandir [PATH]
errno: -4048,
code: 'EPERM',
syscall: 'scandir',
path: 'app.js' }
但如果我不作為服務運行 - 就像 -
node app.js
一切正常,權限很好。
我該怎么做才能解決這個問題? 或者也許還有另一種在 Windows 服務器上運行 nodejs 的選擇?
謝謝!
** 我以管理員身份登錄,並且可以訪問以下目錄
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.