在一个新的 debian jessie ec2 实例上,我执行以下操作:
- sudo apt-get 更新
- sudo apt-get install curl -y
- curl -sL https://deb.nodesource.com/setup_6.x | 须藤 -E bash -
- sudo apt-get install -y nodejs
- mkdir /tmp/real_node_modules
- ln -s /tmp/real_node_modules node_modules
- npm install 'gulp-imagemin'
然后我得到这个错误:
> optipng-bin@3.1.2 postinstall /home/admin/node_modules/optipng-bin
> node lib/install.js
module.js:442
throw err;
^
Error: Cannot find module 'bin-build'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/tmp/real_node_modules/optipng-bin/lib/install.js:3:16)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
npm WARN install:optipng-bin@3.1.2 optipng-bin@3.1.2 postinstall: `node lib/install.js`
npm WARN install:optipng-bin@3.1.2 Exit status 1
> jpegtran-bin@3.0.6 postinstall /home/admin/node_modules/jpegtran-bin
> node lib/install.js
module.js:442
throw err;
^
Error: Cannot find module 'bin-build'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/tmp/real_node_modules/jpegtran-bin/lib/install.js:4:16)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
npm WARN install:jpegtran-bin@3.0.6 jpegtran-bin@3.0.6 postinstall: `node lib/install.js`
npm WARN install:jpegtran-bin@3.0.6 Exit status 1
不用说,没有符号链接的节点模块文件夹,事情就可以工作,但是我想弄清楚的是,如果您有符号链接的节点模块文件夹,它们为什么不能工作。