Running a npm: "Symbol is not defined" - node.js

I'm trying to use: https://github.com/siddharthkp/cost-of-modules
I have npm3 installed on Centos 6.4. When I try to run it I got this error:
[root#XXX public]# cost-of-modules
Making sure dependendies are installed
npm install --production
Calculating...
/usr/local/lib/node_modules/cost-of-modules/lib/helpers.js:167
throw _iteratorError2;
^
ReferenceError: Symbol is not defined
at Object.getSizeForNodeModules (/usr/local/lib/node_modules/cost-of-modules/lib/helpers.js:145:36)
at Object.<anonymous> (/usr/local/lib/node_modules/cost-of-modules/lib/index.js:19:27)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Don't know why it calls to "npm install" I already have npm3 installed. I already asked in the Github's module but I thinks it's not related to that specific module. Please, any help would be appreciated. Thanks.

It was a bug on cost-of-modules. It's solved now here:
https://github.com/siddharthkp/cost-of-modules/issues/24

Related

npm cannot run in Debian: Error: Cannot find module 'node-uuid'

Not really good with this JavaScript world. Trying to install npm and I think it's broken. I'm using Debian and ran:
apt install npm.
Everything went fine but when I run npm it throws up this error
module.js:538
throw err;
^
Error: Cannot find module 'node-uuid'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/nodejs/request/index.js:29:12)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
Nothing works, i can't install the node-uuid either.
I fixed this, I think there's a problem with the package on Debian repo.
I followed the instruction on Node website
https://nodejs.org/en/download/package-manager/
I have npm installed now :)

npm doesn't work on an ARM embedded device

I installed Node.js on an embedded device running with a core Linux 3.0.
When I try to execute npm to install some modules, I get the follow issue :
DM-37x# npm
module.js:340
throw err;
^
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /usr/local/bin/npm:18:11
at Object.<anonymous> (/usr/local/bin/npm:86:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I already tried to reinstall node.js but the bug is still here.
How can I do to fix this problem?
Try installing (or reinstalling) npmlog.
See https://www.npmjs.org/package/npmlog
Make sure you have a package.json file in the top level of your project directory (each project).
Use npm ls
and
npm update
to make sure the npmlog package is included.

'invalid ELF header' error when loading libyaml module

When I go into node and attempt to require libyaml I get:
> require('libyaml')
Error: /home/ubuntu/shadow/node_modules/libyaml/build/Release/binding.node: invalid ELF header
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/home/ubuntu/shadow/node_modules/libyaml/index.js:7:15)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I'm using node version 0.8.12 and libyaml version 0.2.1. Curiously the error is server dependent, but it doesn't seem to be based on the version numbers, because it runs fine on one of boxes with the same versions.
One can also use 'npm rebuild module-name' to recompile the C code on the deployment machine as part of preinstall script.
Documentation
Thanks vinayr for advising me to run npm install on the production box. The issue is that they needed to install npm differently. I resolved that with a pre-deploy command on the box as part of the deploy. Problem solved.

Node throwing an error on ansi module

I'm looking to check out Mike Bostock's Rivers, but I'm running into an error with Node.js. npm install gives me:
module.js:340
throw err;
^
Error: Cannot find module 'ansi'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/Cellar/node/0.10.0/lib/node_modules/npm/node_modules/npmlog/log.js:5:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Any pointers? Or, any previous questions I missed that might point to a solution?
If you run on RH CentOS of Fedore reinstall
yum reinstall nodejs-ansi.noarch
This fixed my similar issue
You can run:
npm install ansi -g
to make ansi available globally (you may have to use sudo)

Error: Cannot find module '../deps/console.log'

I'm on OS X 10.8.2, with Node.js 0.10.0 installed via homebrew. When I try to run npm test on nodegit, I get the following error:
cd test && nodeunit *.js
module.js:340
throw err;
^
Error: Cannot find module '../deps/console.log'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/.bin/nodeunit:11:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
I've done npm update && npm -g update since installing node 0.10.0.
How might I go about fixing this?
The stack trace says it all, it's an issue with nodeunit. I'd file an issue on their issues page.
Not knowing much about nodeunit, it looks like it's anticipating being run from a different location. It's trying to require the file /Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/deps/console.log.js which is (probably) actually located at /Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/nodeunit/deps/console.log.js.

Resources