For example, I want to install a certain module on both mac and win, but not install a certain module on the linux platform. How to set it up? Is it possible?
Replenish
I finally found that it can be done using shell script
#!/bin/bash
echo "正在安装 electron ……"
npm install electron-prebuilt@1.2.1
echo "electron 安装完成"
echo "正在安装 async ……"
npm install async@2.0.1
echo "async 安装完成"
天蓬老师2017-05-16 13:39:43
package.json
I don’t know if it can be done, but it can be implemented using a script.
// index.js
const exec = require('child_process').exec
const platform = process.platform;
switch(platform) {
case 'darwin':
// mac
break;
case 'linux':
exec('npm install XXX')
break;
case 'win32':
break;
}
node index.js
Now you can install XXX
某草草2017-05-16 13:39:43
https://docs.npmjs.com/files/...
Just indicate it in optionalDependencies