【问题标题】:Postinstall script in packgage.jsonpackage.json 中的安装后脚本
【发布时间】:2020-01-24 18:18:26
【问题描述】:

我将我的项目从 bower 迁移到 yarn,现在我有了这个

"postinstall":
"node -e \"try {
require('fs').symlinkSync(require('path').resolve('node_modules/@bower_components'),
'bower_components', 'junction') } 
catch (e) { }\""

在我的package.json 中,postinstall 有什么作用?

【问题讨论】:

  • 这里没有 PostScript。
  • @KenS,我的意思是安装后。

标签: npm bower yarnpkg package.json


【解决方案1】:

这里的postinstall 脚本在每次安装节点包后运行。它的作用是将node_modules/@bower_components 目录象征性地链接到bower_components 目录。因此,每当节点运行时需要访问node_modules/@bower_components 中的文件时,它都会重定向到bower_components 目录并从那里访问文件。

【讨论】:

    猜你喜欢
    • 2018-11-08
    • 1970-01-01
    • 2014-08-07
    • 2015-02-21
    • 2016-12-15
    • 2019-09-04
    • 2018-02-09
    • 1970-01-01
    • 2015-02-11
    相关资源
    最近更新 更多