Sheetjs: Cannot find module './dist/cpexcel' - packaging bug

Created on 14 Dec 2016  ·  6Comments  ·  Source: SheetJS/sheetjs

Hey, I'm getting an error on this:

var XLSX = require('xlsx');

Here's the stack trace:

Error: Cannot find module './dist/cpexcel'
    at require (packages/modules-runtime.js:109:19)
    at make_xlsx (packages/modules.js:422:47)
    at meteorInstall.node_modules.xlsx.xlsx.js (packages/modules.js:12065:3)
    at fileEvaluate (packages/modules-runtime.js:181:9)
    at require (packages/modules-runtime.js:106:16)
    at meteorInstall.server.platform.Methods.js (server/platform/Methods.js:35:12)
    at fileEvaluate (packages/modules-runtime.js:181:9)
    at require (packages/modules-runtime.js:106:16)
    at /home/michael/scm/pid/Iron-Ruler-v2/app/.meteor/local/build/programs/server/app/app.js:3749:1
    at /home/michael/scm/pid/Iron-Ruler-v2/app/.meteor/local/build/programs/server/boot.js:295:34
    at Array.forEach (native)
    at Function._.each._.forEach (/home/michael/.meteor/packages/meteor-tool/.1.4.2_3.m9wg9m++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
    at /home/michael/scm/pid/Iron-Ruler-v2/app/.meteor/local/build/programs/server/boot.js:128:5
    at /home/michael/scm/pid/Iron-Ruler-v2/app/.meteor/local/build/programs/server/boot.js:344:5
    at Function.run (/home/michael/scm/pid/Iron-Ruler-v2/app/.meteor/local/build/programs/server/profile.js:480:12)
    at /home/michael/scm/pid/Iron-Ruler-v2/app/.meteor/local/build/programs/server/boot.js:343:11
Exited with code: 1

Here is a list of node_modules:

☀  ls node_modules                                                                                      Mod dev
adler-32       center-align   exit-on-epipe      locutus               readable-stream       util-deprecate
align-text     cfb            frac               longest               regenerator-runtime   voc
amdefine       cliui          graceful-readlink  meteor-node-stubs     repeat-string         webshot
async          codepage       handlebars         minimist              right-align           window-size
autoprefixer   colors         highcharts         moment                source-map            wordwrap
babel-runtime  commander      inherits           nan                   ssf                   xlsx
babyparse      concat-stream  isarray            node-hubspot          string_decoder        yaml-js
bcrypt         core-js        is-buffer          optimist              toastr                yargs
bindings       core-util-is   jszip              pako                  typedarray
bourbon        crc-32         kind-of            printj                uglify-js
camelcase      decamelize     lazy-cache         process-nextick-args  uglify-to-browserify

Most helpful comment

For the ones like me who just miss the --save in the install...

meteor npm install xlsx --save

All 6 comments

I'm trying to help out @SheetJSDev where I can. He hasn't blessed me or anything, but I've [started a repo] and am trying to take PRs.

I've reproduced your scenario here, but I'm unable to see the same error. Can you confirm?
https://gomix.com/#!/join/b7a7732e-e423-4fc8-83c4-323643c098d3

Hi @tarwich , I'd start with other bugs first. You can probably find lower hanging fruit.

Here are the steps to reproduce more or less:

  1. Install Meteor https://www.meteor.com/install
  2. Start project
  3. meteor npm install xlsx
  4. add this code to any server file var XLSX = require('xlsx');
  5. Start project and notice the error.

@MichaelJCole I was able to reproduce your issue and I believe you need to add a line to the package.json.

Steps:

$ curl https://install.meteor.com/ | sh
$ meteor create ~/my_cool_app
$ cd ~/my_cool_app
$ meteor npm install xlsx
$ vim server/main.js
### add the line var XLSX = require('xlsx'); to the file server/main.js
$ meteor
### ... errors show up
$ vim package.json
### add the line     "xlsx": "" in the block
$ npm install
$ meteor
### no errors

Not familiar with meteor so I am not sure if that is the correct approach.

Hi @reviewher I tried your steps and didn't need to edit package.json for it to work. I'm not sure the issue. Closing as WTF.

Thanks for looking into it :-)

I have same error. I using angular-cli

For the ones like me who just miss the --save in the install...

meteor npm install xlsx --save

Was this page helpful?
0 / 5 - 0 ratings

Related issues

m-ketan picture m-ketan  ·  3Comments

gustavosimil picture gustavosimil  ·  3Comments

eyalcohen4 picture eyalcohen4  ·  3Comments

DannyRyman picture DannyRyman  ·  3Comments

magtuan picture magtuan  ·  3Comments