When I’m trying to import an npm module (e.g. Ramda) I’m getting that Javascript standard library objects are undefined. For example in Ramda, I get this error when trying to do import R from 'ramda'
.
ramda.js:376 Uncaught TypeError: Cannot read property 'isInteger' of undefined
Line 376 is the following
var _isInteger = Number.isInteger || function _isInteger(n) {
...
Basically Number
is undefined, but it’s part of the standard Javascript library so it should be available globally…not sure why this would ever be undefined
. Another person who’s working on the same project as me doesn’t run into these errors when running the project. Not sure why it only doesn’t work for me.
EDIT: Ramda is being imported by a file located in /lib
so it’s run on both the server and client. I did a console.log(Number)
right about Line 376 in the ramda node_module. Only on the client is it undefined…unfortunately I need it on both the client and server.