javascript - uglifyjs - symfony assetic 转储, Node 路径

标签 javascript node.js symfony assetic

我可以在我的 ubuntu 开发服务器上本地使用 uglifyjs,但是当使用远程 Centos 机器进行生产时,我在运行时收到以下错误

$ php app/console assetic:dump

返回一个[RuntimeException]

Path to node executable could not be resolved.

我相信如果我运行,node 和 uglifyjs 都会安装

$ which node 
  /usr/bin/nodejs
$ which uglifyjs 
  /usr/bin/uglifyjs

我的config.yml部分位于下面

# Assetic Configuration
assetic:
  debug:          "%kernel.debug%"
  use_controller: false
  bundles:        [eventsBundle]

  node: /usr/bin/nodejs
  filters:
    uglifyjs2:
    # the path to the uglifyjs executable
    bin: /usr/bin/uglifyjs

我也尝试过

...
  bin: /usr/lib/node_modules/uglify-js 
...

最佳答案

config.yml如下

# Assetic Configuration
  assetic:
    debug:          "%kernel.debug%"
    use_controller: "%kernel.debug%"
    bundles:        [eventsBundle]

    filters:
      uglifyjs2:
      # the path to the uglifyjs executable
      bin: /usr/bin/uglifyjs

在终端中首次运行

$ php app/console cache:clear --env=prod

然后

$ php app/console assetic:dump --env=prod 

关于javascript - uglifyjs - symfony assetic 转储, Node 路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35601043/

相关文章:

javascript - 使用动画展开/折叠菜单列表

javascript - CSS 背景图像之间的过渡

javascript - 常量应用程序 : () => React$Node = () => {. ..} : what does it mean this instruction?

git - 尝试使用 nodejs 运行 git shortlog 时,Exec 不返回任何内容

php - 连接到数据库 Symfony 4 Flex

javascript - 使用 jQuery.getJson 获取 Web API

node.js - 使用 Heroku 作为代理好吗?

node.js - 使用node.io抓取时如何添加像Tor这样的代理?

javascript - 将 AngularJS 与 Symfony2(Routing + Twig)混合使用,或者更好地使用另一个 JS 框架?

php - 编写 .htaccess 以保护 Web 应用程序中的 Symfony 目录时出错