问题描述
我有一个节点js应用程序,需要将其推送到Cloud Foundry。 oracle二进制下载已被防火墙阻止,因此npm install无法下载节点oracledb依赖性。我已经将其手动安装在本地node_modules文件夹下。现在,当我将应用程序推送到CF时,它将再次尝试下载节点oracledb依赖关系,该依赖关系已存在于本地node_modules文件夹中。
我的查询是如何在package.json或package-lock.json中提及此问题,以便CF不会每次推送都下载节点oracledb。我希望它仅使用捆绑的依赖项。
PS添加代理无法在此工作,因为此平台特定的二进制文件托管在S3.AWS上,并已被我们的组织阻止。
I have a node js app which needs to be pushed to cloud foundry. The oracle binary download is blocked by firewall so npm install fails to download node oracledb dependency. I have manually installed it under local node_modules folder. Now when i push my app to CF, it agains try to download node oracledb dependency, which is already present in local node_modules folder. My query is how can i mention this in package.json or package-lock.json so that CF does not download node oracledb with every push. I want it to use only bundled dependency.P.S adding proxy won't work here as this platform specific binary is hosted over S3.AWS on internet and is blocked by our org.
推荐答案
经过大量研究和实验,我无需使用docker image即可实现此目标。
在package.json中-
After much research and experiments, I was able to achieve this without docker image.In package.json -
"dependencies": {
"crypto": "^1.0.1",
"express": "^4.16.3",
"morgan": "^1.9.0",
"nan": "^2.11.0",
"oracledb": "file:oracledb_build",
"typeorm": "^0.2.7"
}
如果我们提到项目中的相对文件位置,npm将从那里寻找oracledb依赖关系而不是转到Internet,它解决了这个问题。
,如果我们提到-
oracledb: ^ 2.3.0-即使您手动将oracledb复制到node_modules中并提供匹配的二进制文件,它也总是通过Internet下载特定于平台的二进制文件建筑。我已经在oracledb 2.3.0中观察到了这种行为。
当我在本地提供oracledb 2.0.15时,我的问题得到解决。
if we mention the relative file location in project from where npm should look for oracledb dependency instead of going over to internet, it solves this problem.if we mention -"oracledb": "^2.3.0" --It always goes over to internet to download platform specific binary, even if you manually copy oracledb into node_modules, and provide binary with matching architecture. I have observed this behavior with oracledb 2.3.0.My problem got resolved when i provided oracledb 2.0.15 locally.
这篇关于由于无法在防火墙后下载节点oracledb dep,因此在Cloud Foundry上运行的节点js应用程序失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!