" cpexcel not found " angular 2 application with systemJS #547

Closed
opened 2017-01-30 15:13:20 +00:00 by Mani2693 · 5 comments
Mani2693 commented 2017-01-30 15:13:20 +00:00 (Migrated from github.com)

Hi Guys,

I found error while exporting highcharts with Angular 2 application , It says cpexcel.js not found

My systemjs.config file looks as below :

(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/',
'vendor:': 'externallibs/'
},
// map tells the System loader where to look for things
map: {
// For Excel export
'jszip': 'npm:xlsx/jszip.js',
'xlsx': 'npm:xlsx/xlsx.js',
'saveAs': 'vendor:FileSaver/FileSaver.js',
}
meta: {
'jszip': {
exports: 'JSZip',
},
'xlsx': {
deps: ['jszip']
},
'saveAs': {
exports: 'saveAs'
},
}
});
})(this);

Error says " cannot find cpexcel.js " , When I see into the xlsx.js line no 10: causing the issue
When I change
cptable = require('./dist/cpexcel');
To
cptable = System.import('./dist/cpexcel');

It works perfectly fine, But I don't want to make changes with my local code
because every time when I install using npm I need to make changes again and again

I need a revised version from git which I can use when it is required , Few may also face the same issue with highcharts export , angular 2 and systermJS as module loader.

If any other fix please suggest me

Thanks in advance !

Hi Guys, I found error while exporting highcharts with Angular 2 application , It says cpexcel.js not found **My systemjs.config file looks as below :** (function (global) { System.config({ paths: { // paths serve as alias 'npm:': 'node_modules/', 'vendor:': 'externallibs/' }, // map tells the System loader where to look for things map: { // For Excel export 'jszip': 'npm:xlsx/jszip.js', 'xlsx': 'npm:xlsx/xlsx.js', 'saveAs': 'vendor:FileSaver/FileSaver.js', } meta: { 'jszip': { exports: 'JSZip', }, 'xlsx': { deps: ['jszip'] }, 'saveAs': { exports: 'saveAs' }, } }); })(this); Error says " cannot find cpexcel.js " , When I see into the xlsx.js line no 10: causing the issue When I change cptable = require('./dist/cpexcel'); To cptable = System.import('./dist/cpexcel'); It works perfectly fine, But I don't want to make changes with my local code because every time when I install using npm I need to make changes again and again I need a revised version from git which I can use when it is required , Few may also face the same issue with highcharts export , angular 2 and systermJS as module loader. If any other fix please suggest me Thanks in advance !
leehung-net commented 2017-03-04 03:39:33 +00:00 (Migrated from github.com)

i had same error

i had same error
SheetJSDev commented 2017-03-11 00:07:10 +00:00 (Migrated from github.com)

@Mani2693 @loongdefect we are not familiar with systemjs, but if you have a very small demo we can take a look.

@Mani2693 @loongdefect we are not familiar with systemjs, but if you have a very small demo we can take a look.
leehung-net commented 2017-03-11 03:00:08 +00:00 (Migrated from github.com)

Hi you. I use angular-cli and it use webpack load module. Your lib use
filesystem not working on it.

On Sat, Mar 11, 2017, 7:07 AM SheetJSDev notifications@github.com wrote:

@Mani2693 https://github.com/Mani2693 @loongdefect
https://github.com/loongdefect we are not familiar with systemjs, but if
you have a very small demo we can take a look.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/SheetJS/js-xlsx/issues/547#issuecomment-285819030, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AH3p8FD13OPmMbEheI9pHLGjDa3NAOKXks5rkeWxgaJpZM4Lxg_l
.

Hi you. I use angular-cli and it use webpack load module. Your lib use filesystem not working on it. On Sat, Mar 11, 2017, 7:07 AM SheetJSDev <notifications@github.com> wrote: @Mani2693 <https://github.com/Mani2693> @loongdefect <https://github.com/loongdefect> we are not familiar with systemjs, but if you have a very small demo we can take a look. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <https://github.com/SheetJS/js-xlsx/issues/547#issuecomment-285819030>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AH3p8FD13OPmMbEheI9pHLGjDa3NAOKXks5rkeWxgaJpZM4Lxg_l> .
SheetJSDev commented 2017-03-13 00:24:55 +00:00 (Migrated from github.com)

@loongdefect you should not use readFile or writeFile in browser -- use read and write

@loongdefect you should not use `readFile` or `writeFile` in browser -- use `read` and `write`
SheetJSDev commented 2017-03-23 16:52:00 +00:00 (Migrated from github.com)

@Mani2693 The following systemjs config appears to work:

SystemJS.config({
	paths: {
		'npm:': '/usr/local/lib/node_modules/'
	},
	map: {
		'xlsx': 'npm:xlsx/xlsx.js',
		'fs': '@node/fs',
		'crypto': '@node/fs' 
	}
});

The fs and crypto really should be suppressed but it was not obvious how to suppress node modules in systemjs. We will be adding a systemjs demo shortly

@Mani2693 The following systemjs config appears to work: ```js SystemJS.config({ paths: { 'npm:': '/usr/local/lib/node_modules/' }, map: { 'xlsx': 'npm:xlsx/xlsx.js', 'fs': '@node/fs', 'crypto': '@node/fs' } }); ``` The `fs` and `crypto` really should be suppressed but it was not obvious how to suppress node modules in systemjs. We will be adding a systemjs demo shortly
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#547
No description provided.