如何安装 npm 包的分支?

How do I install fork of an npm package?

当我这样做时:

rm -r node_modules \
    && npm i webpack-cleanup-plugin \
    && node -r webpack-cleanup-plugin -e 'console.log("success")'

成功了。但是这样:

rm -r node_modules \
    && npm i bassarisse/webpack-cleanup-plugin \
    && node -r webpack-cleanup-plugin -e 'console.log("success")'

它失败了:

module.js:472
    throw err;
    ^

Error: Cannot find module 'webpack-cleanup-plugin'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at module.js:656:12
    at Array.forEach (native)
    at Function.Module._preloadModules (module.js:655:12)
    at preloadModules (bootstrap_node.js:391:38)
    at startup (bootstrap_node.js:107:9)
    at bootstrap_node.js:533:3

我做错了什么?

原源码包含babel源码,安装前需预编译

您可以从 .gitignore 中删除 lib,使用 npm run build 编译并在 lib 文件夹中提交编译后的代码。然后可以从github

安装