首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在生产环境中使用pm2启动节点应用程序时出现问题

在生产环境中使用pm2启动节点应用程序时出现问题
EN

Stack Overflow用户
提问于 2016-11-01 20:37:54
回答 1查看 261关注 0票数 0

我有一个Apostrophe-CMS的实例,目前我正试图将其部署到生产环境中。运行sudo npm start运行良好,并且应用程序启动。然而,当我试图让pm2守护进程运行它时,我得到了一个符号链接错误:

Error: EEXIST: file already exists, symlink '/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/public' -> '/var/sites/hackday-2016-microsite/public/modules/apostrophe-assets' hackday2016-28 at Error (native) hackday2016-28 at Object.fs.symlinkSync (fs.js:1048:18) hackday2016-28 at Object.self.linkAssetFolderOnUnix (/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:447:10) hackday2016-28 at Object.self.linkAssetFolder (/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:424:14) hackday2016-28 at /var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:402:14 hackday2016-28 at /var/sites/hackday-2016-microsite/node_modules/lodash/index.js:3073:15 hackday2016-28 at baseForOwn (/var/sites/hackday-2016-microsite/node_modules/lodash/index.js:2046:14) hackday2016-28 at /var/sites/hackday-2016-microsite/node_modules/lodash/index.js:3043:18 hackday2016-28 at Function.<anonymous> (/var/sites/hackday-2016-microsite/node_modules/lodash/index.js:3346:13) hackday2016-28 at self.symlinkModules (/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:398:9) hackday2016-28 at /var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:718:13 hackday2016-28 at iterate (/var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:262:13) hackday2016-28 at async.forEachOfSeries.async.eachOfSeries (/var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:281:9) hackday2016-28 at _parallel (/var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:717:9) hackday2016-28 at Object.async.series (/var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:739:9) hackday2016-28 at Object.self.afterInit (/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:349:20)

EN

回答 1

Stack Overflow用户

发布于 2016-11-17 09:20:53

我也是ApostropheCMS的新手,已经玩了一段时间了。看起来您创建了一个符号链接来将撇号资产文件夹链接到公共文件夹?我不明白为什么要这么做。AposCMS会自动拾取

node_modules/apostrophe/lib/modules/apostrophe-assets/public和

/var/sites/hackday-2016-microsite/public/modules/apostrophe-assets文件夹。

您所要做的就是确保声明了在/var/sites/hackday-2016-microsite/lib/modules/apostrophe-pages/index.js下为项目添加的资产

下面是我的文件下的代码

代码语言:javascript
复制
    module.exports = {
        park: [{
            slug: '/search',
            type: 'apostrophe-search',
            label: 'Search',
            published: true
        }],
        types: [{
                name: 'default',
                label: 'Default'
            },
            {
                name: 'home',
                label: 'Home'
            },
            {
                name: 'apostrophe-blog-page',
                label: 'Blog'
            }
        ],

    //construct is one of the nunjucks functions that gets called when app.js starts
    construct: function(self, options) {

        //push assets to for use in front end - e.g. lib/modules/apostrophe-pages/public/js/site.js

        self.pushAsset('script', 'site', { scene: 'always' });
        self.pushAsset('script', 'jquery.easing', { scene: 'always' });
        self.pushAsset('script', 'jquery.scrollTo', { scene: 'always' });
        self.pushAsset('script', 'bootstrap', { scene: 'always' });
        self.pushAsset('script', 'jquery.easing', { scene: 'always' });
        self.pushAsset('script', 'jquery.matchHeight', { scene: 'always' });
        self.pushAsset('script', 'jquery.easy-autocomplete', { scene: 'always' });
    }
};

为了添加css文件,您可以在下面的

/var/sites/hackday-2016-microsite/public/modules/apostrophe-assets/public/css/site.less我在文件中的代码是:

代码语言:javascript
复制
@import 'utilities/_index.less';
@import 'typography/_index.less';
@import 'layout/_index.less';
@import 'templates/_index.less';
@import 'components/_index.less';
@import 'global/_index.less';
@import 'components/easy-autocomplete.less';
@import 'components/easy-autocomplete.themes.less';
// this is the place were we are adding the css syles so that they get automatically compiled
// and are minified and send out as one file
@import 'custom/bootstrap.less';
@import 'custom/font-awesome.less';
@import 'custom/jquery.autocomplete.less';
@import 'custom/simple-sidebar.less';
@import 'custom/style.less';

.apos-slideshow-item
{
  h4
  {
    display: none;
  }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40360241

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档