Is your feature request related to a problem? Please describe.
Users (even experience node users like me, I'm ashamed to admit) install node for Windows on new boxes, and everything is fine installing modules for a little while until one day they need a native modules, and something seems broken. They spend a little while searching and find out they need to yarn add global windows-build-tools or npm -g install windows-build-tools
Essentially, windows-build-tools could be considered a dependency for node on Windows in the same way gcc-c++ is on Linux. As a result, it should be handled better.
Describe the solution you'd like
My gut feeling is for build tools to be installed by the node installer. Things should 'just work'.
Describe alternatives you've considered
How frequently are native modules needed? I'll let the community decide, but
If native modules are frequently needed, I'd like windows-build-tools to be there out of the box, in the same way that gcc-c++ is on Linux.
If there are some situations where local modules aren't needed, so we can't have windows-build-tools as a hard dependency, I'd like node to strongly recommend installing windows-build-tools - perhaps during compilation of native modules, perhaps after install.
I don't have any hard thoughts one way or the other, just interested in what other Windows node users have experienced here.
Providing this as an optional extra install sounds like a good idea to me.
/cc @nodejs/platform-windows @felixrieseberg
Essentially, windows-build-tools could be considered a dependency for node on Windows in the same way gcc-c++ is on Linux.
AFAIK gcc in not a dependency. For example the nodesource .debs don't depend on it directly.
Aside from that windows-build-tools has some fundamental issues (licensing, maintenance, side-by-side compatibility), although it does have many benefits. As such I believe only Microsoft can provide a full solution, similar to what they did for Python2.7, a.k.a Microsoft Visual C++ Compiler for Python 2.7.
So IMHO keeping it as an opt-in recommendation is still the optimal option - https://github.com/nodejs/node-gyp#on-windows
P.S. running npm install scrypt on a vanilla ubuntu (with just node 10.8) gives a similar obscure error:
ubuntu@ip-172-30-0-137:~/node-v10.8.0-linux-x64/bin$ npm install scrypt
> [email protected] preinstall /home/ubuntu/node-v10.8.0-linux-x64/bin/node_modules/scrypt
> node node-scrypt-preinstall.js
Error: Error: Command failed: ./configure
configure: error: in `/home/ubuntu/node-v10.8.0-linux-x64/bin/node_modules/scrypt/scrypt/scrypt-1.2.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
> [email protected] install /home/ubuntu/node-v10.8.0-linux-x64/bin/node_modules/scrypt
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (/home/ubuntu/node-v10.8.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:492:19)
gyp ERR! stack at PythonFinder.<anonymous> (/home/ubuntu/node-v10.8.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack at F (/home/ubuntu/node-v10.8.0-linux-x64/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack at E (/home/ubuntu/node-v10.8.0-linux-x64/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /home/ubuntu/node-v10.8.0-linux-x64/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /home/ubuntu/node-v10.8.0-linux-x64/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /home/ubuntu/node-v10.8.0-linux-x64/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.4.0-1061-aws
gyp ERR! command "/home/ubuntu/node-v10.8.0-linux-x64/bin/node" "/home/ubuntu/node-v10.8.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/node-v10.8.0-linux-x64/bin/node_modules/scrypt
gyp ERR! node -v v10.8.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/home/ubuntu/node-v10.8.0-linux-x64/bin/package.json'
npm WARN bin No description
npm WARN bin No repository field.
npm WARN bin No README data
npm WARN bin No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2018-08-14T16_44_00_058Z-debug.log
Thanks @refack. Do you think the message produced by nodesource debs to could be a good example?
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
I could imagine the windows installer providing similar advice to install windows-build-tools at the end of the process would fix a lot of these cases. As you've mentioned, the docs already ask people to do this.
I could imagine the windows installer providing similar advice to install windows-build-tools at the end of the process would fix a lot of these cases.
That does sound like a good idea.
Let's see if anyone in @nodejs/platform-windows (@jdalton who revealed himself as Windows adjacent) has the skill and bandwidth to follow up.
Thanks Joao! 😃✨ I
On Sun, 2 Sep 2018 at 12:44 am, João Reis notifications@github.com wrote:
PR: #22645 https://github.com/nodejs/node/pull/22645
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/node/issues/22311#issuecomment-417894851, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAKiMjlOXiOYim_pfTmo93PfDdYuDMj1ks5uWxvpgaJpZM4V8QX6
.
Most helpful comment
That does sound like a good idea.
Let's see if anyone in @nodejs/platform-windows (@jdalton who revealed himself as Windows adjacent) has the skill and bandwidth to follow up.