alexgorbatchev / crc

Blazingly fast CRC implementations for node.js and browser
MIT License
345 stars 72 forks source link

Cannot find module './define_crc' #39

Closed franckl closed 7 years ago

franckl commented 8 years ago

Hi

I am having the following error after express-session upgraded its dependencies to the latest node-crc version (using node 0.10):

Error: Cannot find module './define_crc'
    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> (/var/lib/openshift/54d0254bfcf9332adf0000a6/app-root/runtime/repo/node_modules/express-session/node_modules/crc/lib/crc1.js:5:19)
    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)
DEBUG: Program node server.js exited with code 8
DEBUG: Starting child process with 'node server.js'
module.js:340
    throw err;
          ^

See : https://github.com/expressjs/session/issues/267

alexgorbatchev commented 8 years ago

I'm not really sure how to reproduce this. Can you check if define_crc.js is there?

$ npm i crc
/tmp
└── crc@3.4.0

$ node -v
v0.10.33

$ node -e "console.log(require('crc'))"
{ crc1: { [Function: fn] signed: [Function], unsigned: [Circular], model: 'crc1' },
  crc8: { [Function: fn] signed: [Function], unsigned: [Circular], model: 'crc-8' },
  crc81wire:
   { [Function: fn]
     signed: [Function],
     unsigned: [Circular],
     model: 'dallas-1-wire' },
  crc16: { [Function: fn] signed: [Function], unsigned: [Circular], model: 'crc-16' },
  crc16ccitt: { [Function: fn] signed: [Function], unsigned: [Circular], model: 'ccitt' },
  crc16modbus:
   { [Function: fn]
     signed: [Function],
     unsigned: [Circular],
     model: 'crc-16-modbus' },
  crc16xmodem: { [Function: fn] signed: [Function], unsigned: [Circular], model: 'xmodem' },
  crc16kermit: { [Function: fn] signed: [Function], unsigned: [Circular], model: 'kermit' },
  crc24: { [Function: fn] signed: [Function], unsigned: [Circular], model: 'crc-24' },
  crc32: { [Function: fn] signed: [Function], unsigned: [Circular], model: 'crc-32' } }
dsevillamartin commented 7 years ago

Happens to me as well in Heroku, node v5.11.1, but not locally.

2016-09-25T14:14:42.746729+00:00 app[web.1]: module.js:341
2016-09-25T14:14:42.746740+00:00 app[web.1]:     throw err;
2016-09-25T14:14:42.746741+00:00 app[web.1]:     ^
2016-09-25T14:14:42.746742+00:00 app[web.1]: 
2016-09-25T14:14:42.746747+00:00 app[web.1]: Error: Cannot find module './define_crc'
2016-09-25T14:14:42.746748+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:339:15)
2016-09-25T14:14:42.746748+00:00 app[web.1]:     at Function.Module._load (module.js:290:25)
2016-09-25T14:14:42.746749+00:00 app[web.1]:     at Module.require (module.js:367:17)
2016-09-25T14:14:42.746750+00:00 app[web.1]:     at require (internal/module.js:20:19)
2016-09-25T14:14:42.746751+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/crc/lib/crc1.js:5:19)
2016-09-25T14:14:42.746751+00:00 app[web.1]:     at Module._compile (module.js:413:34)
2016-09-25T14:14:42.746754+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:422:10)
2016-09-25T14:14:42.746754+00:00 app[web.1]:     at Module.load (module.js:357:32)
2016-09-25T14:14:42.746755+00:00 app[web.1]:     at Function.Module._load (module.js:314:12)
2016-09-25T14:14:42.746756+00:00 app[web.1]:     at Module.require (module.js:367:17)

If I install crc while SSHd in Heroku (with npm i crc), and then execute node -e "console.log(require('crc'))", it doesn't error me.

alexgorbatchev commented 7 years ago

Any way you can tell what version is it trying to install? Also, have you tried npm cache clean?

dsevillamartin commented 7 years ago

@alexgorbatchev The install is fresh, as it is from Heroku and because I don't commit node_modules. I added crc to package.json as a dependency, to see if that would fix it, but it still gives the same error. Works fine for me in Openshift, though, and I only changed IP and PORT for web server listening.

alexgorbatchev commented 7 years ago
$ node --version
v5.1.0

$ npm info crc
...
  dist:
   { shasum: '4258e351613a74ef1153dfcb05e820c3e9715d7f',
     tarball: 'http://registry.npmjs.org/crc/-/crc-3.4.0.tgz' },

$ curl -O http://registry.npmjs.org/crc/-/crc-3.4.0.tgz
...

$ tar xzvf crc-3.4.0.tgz
x package/package.json
x package/README.md
x package/LICENSE
x package/lib/crc1.js
x package/lib/crc16_ccitt.js
x package/lib/crc16_kermit.js
x package/lib/crc16_modbus.js
x package/lib/crc16_xmodem.js
x package/lib/crc16.js
x package/lib/crc32.js
x package/lib/crc8.js
x package/lib/crc8_1wire.js
x package/lib/define_crc.js
x package/lib/index.js
x package/lib/crc24.js

The lib/define_crc.js is there in the current 3.4.0 version. Are you getting an older version perhaps which might have been broken? I need more info to debug this.

dsevillamartin commented 7 years ago
~ $ node -v
v5.11.1
~ $ npm info crc

{ name: 'crc',
  description: 'Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the Browser.',
  'dist-tags': { latest: '3.4.0' },
  versions: 
   [ ••• ],
  maintainers: [ 'alexgorbatchev <alex.gorbatchev@gmail.com>' ],
  time: 
   { •••' },
  author: 'Alex Gorbatchev (https://github.com/alexgorbatchev)',
  repository:  { ••• },
  users: { ••• },
  homepage: 'https://github.com/alexgorbatchev/node-crc',
  bugs: { url: 'https://github.com/alexgorbatchev/node-crc/issues' },
  readmeFilename: 'README.md',
  keywords: [ 'crc' ],
  license: 'MIT',
  version: '3.4.0',
  files: [ 'lib' ],
  main: './lib/index.js',
  scripts: { •••' },
  devDependencies: { ••• },
  babel: { presets: [ 'es2015' ] },
  gitHead: '3726e792cb4a328ef2d935cfd896e54fa9529aaf',
  dist: 
   { shasum: '4258e351613a74ef1153dfcb05e820c3e9715d7f',
     tarball: 'https://registry.npmjs.org/crc/-/crc-3.4.0.tgz' },
  directories: {} }

I'm getting v3.4.0 :/


EDIT

~/node_modules/crc/lib $ ls
crc1.js  crc16.js  crc16_ccitt.js  crc16_modbus.js  crc24.js  crc32.js  crc8.js  crc8_1wire.js  index.js
alexgorbatchev commented 7 years ago

closing this, i'm not really sure what to do here...