gpt4 book ai didi

node.js - 当 node_modules 文件夹是符号链接(symbolic link)时 browserify-shim 错误

转载 作者:搜寻专家 更新时间:2023-11-01 00:09:33 25 4
gpt4 key购买 nike

在生产服务器上,node_modules 文件夹是用于持续部署目的的符号链接(symbolic link)。当我运行 gulp 命令时,出现了很多这样的错误:
错误:解析文件时无法在/home/web/www/persist/node_modules/jquery-ui/jquery-ui.js 的 package.json 中找到 browserify-shim 配置部分:/home/web/www/persist/node_modules/jquery-ui/jquery-ui.js]
文件名:'/home/web/www/persist/node_modules/jquery-ui/jquery-ui.js'
. . .
如果我在项目文件夹中移动 node_modules,构建过程就会成功。如何解决这个问题?

最佳答案

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

Linking breaks browserify and shim since your projects dependencies are outside of your project tree. So when looking upwards these tools can't find the package.json of your package anymore.

So don't link your node_modules folders .. it's a bad idea anyways since you're then linked to a global in your system, i.e. it's better to have all your deps be local to your project. Not sure what your deployment purposes are, but to me it seems like whoever made that decision didn't fully understand how node/npm is supposed to work.

关于node.js - 当 node_modules 文件夹是符号链接(symbolic link)时 browserify-shim 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36559378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com