【问题标题】:browserify-shim error when node_modules folder is a symlinknode_modules 文件夹是符号链接时的 browserify-shim 错误
【发布时间】:2016-08-02 05:53:56
【问题描述】:

生产服务器上的 node_modules 文件夹是用于持续部署目的的符号链接。 当我运行 gulp 命令时,我遇到了很多这样的错误: Error: Unable to find a browserify-shim config section in the package.json for /home/web/www/persist/node_modules/jquery-ui/jquery-ui.js while parsing file: /home/web/www/persist/node_modules/jquery-ui/jquery-ui.js] filename: '/home/web/www/persist/node_modules/jquery-ui/jquery-ui.js' . . . 如果我在项目文件夹中移动 node_modules,则构建过程成功。如何解决这个问题?

【问题讨论】:

    标签: node.js gulp browserify node-modules browserify-shim


    【解决方案1】:

    thlorenz(browserify-shim 的作者)的回答

    链接会中断 browserify 和 shim,因为您的项目依赖项 在您的项目树之外。所以当向上看这些工具时 找不到你的包的 package.json 了。

    所以不要链接你的 node_modules 文件夹.. 反正这是个坏主意 因为然后您将链接到系统中的全局变量,即更好 让您的所有部门都在您的项目中。不确定你的 部署目的是,但在我看来,无论是谁做的 决定没有完全理解 node/npm 应该如何工作。

    【讨论】:

    • 没有帮助。 node_modules 中的符号链接存在有效的依赖关系,例如多包存储库 (monorepos)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-14
    • 2018-12-23
    • 2016-10-17
    • 2016-09-05
    • 2015-05-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多