node-voo
node-voo copied to clipboard
Windows: set NODE_OPTIONS fails to run npm afterwards
- Installed
node-vooglobally
npm i node-voo -g
- Set NODE_OPTIONS as described in documentation
set NODE_OPTIONS=-r node-voo
node <real-entry> <arguments>
And now every npm run fails with error
internal/modules/cjs/loader.js:611
throw err;
^
Error: Cannot find module 'node-voo'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
at Function.Module._load (internal/modules/cjs/loader.js:535:25)
at Module.require (internal/modules/cjs/loader.js:663:17)
at Module._preloadModules (internal/modules/cjs/loader.js:865:12)
at prepareUserCodeExecution (internal/bootstrap/node.js:483:5)
at startMainThreadExecution (internal/bootstrap/node.js:438:3)
internal/modules/cjs/loader.js:611
throw err;
^
Error: Cannot find module 'node-voo'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
at Function.Module._load (internal/modules/cjs/loader.js:535:25)
at Module.require (internal/modules/cjs/loader.js:663:17)
at Module._preloadModules (internal/modules/cjs/loader.js:865:12)
at prepareUserCodeExecution (internal/bootstrap/node.js:483:5)
at startMainThreadExecution (internal/bootstrap/node.js:438:3)
Windows 10 Node 11.9.0
@creage is this thrown from a child process? is node-voo requirable from the location of that file?
@hulkish I've installed node-voo globally, so yes - it is accessible. And I can run node <script> with no problems. It is only npm fails.
@creage installing it globally does not guarantee it will work. It must be in one of the node_modules dirs which exist relative to where you are doing the require.
Since you're using NODE_OPTIONS="-r node-voo", it still tries to require it locally - not globally. So, you should do one of:
- install it locally to the project (recommended)
- provide absolute path to
-rglobally installed of locationnode-voo