-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Requiring modules which have been linked using npm link does not work via iisnode. This is a problem for me because I use linked modules while developing, but can't test my changes through IIS. I can run the application from the command line of course, but it's not such a good test as the live environment goes through IIS/iisnode.
I've used lodash in the example below just so it's easier to reproduce the problem. Normally I would be including modules from our private registry.
I'm on Windows 10 Pro, x64, IIS 10. Not sure how to find out the iisnode module version.
Steps to reproduce:
index.js:
var http = require('http');
const _ = require('lodash');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('hello');
}).listen(process.env.PORT);
Create a module called lodash somewhere, and link it into your project.
cd to your module and do npm link
cd to your project and do npm link lodash
From the command line, running node index.js works fine. But going through iisnode gives me this error:
Error: Cannot find module 'lodash'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\web\symlink-test\index.js:2:11)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)