zea*_*ker 22 node.js npm node-gyp yarnpkg
看起来好像yarn没有将node-gyp标志传递给本机包npm.
例如,当尝试使用以下命令安装sqlite3@3.1.6时:
npm install sqlite3@3.1.6 \
--build-from-source \
--sqlite_libname=sqlcipher \
--sqlite=`brew --prefix` \
--verbose
Run Code Online (Sandbox Code Playgroud)
我们成功安装了带有sqlcipher扩展的sqlite3,由于传递--sqlite_libname而且--sqlite是在sqlite3 中指定的binding.gyp.
但是,当试图使用yarn并运行我认为是等效的命令时,看起来标志不符合:
yarn add sqlite3@3.1.6 \
--force \
--build-from-source \
--sqlite_libname=sqlcipher \
--sqlite=`brew --prefix` \
--verbose
Run Code Online (Sandbox Code Playgroud)
使用npm无法识别的命令行参数将转换为gyp标志.
有了yarn这似乎并没有工作.
有没有办法获得此功能yarn?
目前可以通过在格式上使用环境变量来实现 npm_config_{snake_case_param}=true/false
例如,npm install --build-from-source=true变成:
npm_config_build_from_source=true yarn install
Run Code Online (Sandbox Code Playgroud)
它记录在这里https://yarnpkg.com/lang/en/docs/envvars/#toc-npm-config
| 归档时间: |
|
| 查看次数: |
3096 次 |
| 最近记录: |