floralvikings / jira-connector

NodeJS Wrapper for the Jira REST API
http://floralvikings.github.io/jira-connector/
MIT License
373 stars 180 forks source link

Error message using the Jira connector / Sharepoint SPFx #234

Open iuaj7 opened 4 years ago

iuaj7 commented 4 years ago

Hi, I tried to use the Jira connector in a Sharepoint SPFx webpart (Typescript, React).

Environment: npm is version 6.8.0, tsc is version 3.7.3

First I installed using "npm install jira-connector". Output is:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  • jira-connector@3.1.0 added 7 packages from 7 contributors and audited 107580 packages in 37.247s found 812 vulnerabilities (250 low, 28 moderate, 529 high, 5 critical)

package.json is: ... "jira-connector": "^3.1.0"

The import statement is "import JiraClient from 'jira-connector';" Code after authentication is: "const issue = await jira.issue.getIssue({ issueKey: "JWR-19" });"

When I run "gulp serve" the following error message is displayed:

Error - typescript - node_modules\jira-connector\types\callback.d.ts(0,27): error TS1005: ',' expected.

callback.d.ts: export type Callback = (err: any, data: TData) => void;

Any ideas whats wrong? My fault? Have I missed something?

MrRefactoring commented 4 years ago

Hi, @iuaj7, can you create a template repo with this error?

iuaj7 commented 4 years ago

@MrRefactoring I uploaded the files to "iuaj7/HelloSharepointJira" without the node_modules directory

MrRefactoring commented 4 years ago

Sorry, but there are no files. Check it one more time :)

MrRefactoring commented 4 years ago

Try import * as JiraClient from 'jira-connector';. Let me know if this helps.

iuaj7 commented 4 years ago

With the modified import statement the "jira = new JiraClient(..." gives me the following error message:

[ts] Cannot use 'new' with an expression whose type lacks a call or construct signature.

iuaj7 commented 4 years ago

Found something. Sharepoint Developer Framework SPFx uses an older Typescript version "[10:44:26] [typescript] TypeScript version: 2.2.2". Seems that SPFx has some internal dependencies and cannot switch to the latest tsc version.

MrRefactoring commented 4 years ago

Found something. Sharepoint Developer Framework SPFx uses an older Typescript version "[10:44:26] [typescript] TypeScript version: 2.2.2". Seems that SPFx has some internal dependencies and cannot switch to the latest tsc version.

Good job @iuaj7. Can you give me PR to fix it?

iuaj7 commented 4 years ago

@MrRefactoring Sorry, but I do not have a solution for the problem. I just identified a possible reason why it is not working. It seems to be a version conflict with the Sharepoint "package.json" dependencies. The problem is similar to using "jquery" with SPFx: "https://thechriskent.com/tag/typescript/"

saschagnthr commented 4 years ago

Any updates on this? I ran into a similar error and can´t use the JiraConnector in my SPFx project. Here´s my error message:

Error - [webpack] 'dist': ./node_modules/jira-connector/api/auth.js Module not found: Error: Can't resolve 'fs' in 'C:/GIT/MyProject/SPFx/MyWebPart/node_modules/jira-connector/api' resolve 'fs' in 'C:/GIT/MyProject/SPFx/MyWebPart/node_modules/jira-connector/api'

MrRefactoring commented 4 years ago

Any updates on this? I ran into a similar error and can´t use the JiraConnector in my SPFx project. Here´s my error message:

Error - [webpack] 'dist': ./node_modules/jira-connector/api/auth.js Module not found: Error: Can't resolve 'fs' in 'C:/GIT/MyProject/SPFx/MyWebPart/node_modules/jira-connector/api' resolve 'fs' in 'C:/GIT/MyProject/SPFx/MyWebPart/node_modules/jira-connector/api'

It seems to me that if you want to use this extension to work on your site, then you cannot do it. I would look towards jira.js