[Pkg-javascript-devel] Bug#977232: babeljs-node is unable to find system modules
Pirate Praveen
praveen at onenetbeyond.org
Sat Dec 12 20:36:42 GMT 2020
Package: node-babel7
Version: 7.12.9+~cs150.130.99-1
Severity: important
When trying to run mocha using babeljs-node command, it fails to find
the modules installed in global nodejs directories.
pravi at mahishi:~/forge/js-team/node-window-size$ babeljs-node
/usr/bin/mocha -R spec
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'v8flags'
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>
(/usr/share/nodejs/@babel/node/lib/babel-node.js:3:39)
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)
Once I manually set the NODE_PATH variable, it starts working. We
should probably set these paths before calling babeljs-node command.
pravi at mahishi:~/forge/js-team/node-window-size$ export
NODE_PATH=/usr/lib/nodejs:debian/tests/test_modules:/usr/share/nodejs:/usr/lib/x86_64-linux-gnu/nodejs/:/usr/share/nodejs/mocha/node_modules
pravi at mahishi:~/forge/js-team/node-window-size$ babeljs-node
/usr/bin/mocha -R spec
window-size
✓ should return an object with width and height
✓ should expose a `.get` method to get up-to-date size
✓ should get size from process.stdout
✓ should get size from process.stderr
✓ should get size from process.env
✓ should get size from tty
✓ should get size from tput
utils
✓ should expose a `.get` method to get up-to-date size
✓ should get size from process.env
✓ should get size from tty
✓ should get size from tput
11 passing (27ms)
pravi at mahishi:~/forge/js-team/node-window-size$
Some other things I found in this experiment,
1. node-environment-flags module which is required in
/usr/share/nodejs/@babel/node/lib/babel-node.js is only available in
/usr/share/nodejs/mocha/node_modules
Error: Cannot find module 'node-environment-flags'
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>
(/usr/share/nodejs/@babel/node/lib/babel-node.js:7:52)
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)
2. Also node-yargs is missing a dependency on node-define-property.
/usr/share/nodejs/yargs/yargs.js:1242
else throw err
^
Error: Cannot find module 'define-property'
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>
(/home/pravi/forge/js-team/node-window-size/index.js:10:14)
More information about the Pkg-javascript-devel
mailing list