Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM postinstall error @voitanos/jest-preset-spfx-react16@1.5.0 #15

Open
Hylar-86 opened this issue Feb 2, 2023 · 5 comments
Open

NPM postinstall error @voitanos/jest-preset-spfx-react16@1.5.0 #15

Hylar-86 opened this issue Feb 2, 2023 · 5 comments

Comments

@Hylar-86
Copy link

Hylar-86 commented Feb 2, 2023

We are going through the steps in the ReadMe for doing some Jest testing with out SPFx webparts. When we run the npm install jest @voitanos/jest-preset-spfx-react16 --save-dev it is erroring out with the following:

$ npm install jest @voitanos/jest-preset-spfx-react16 --save-dev

@voitanos/jest-preset-spfx-react16@1.5.0 postinstall C:\Users\kkittinger\Documents\DevOps Resp\SPFX Development\React\FAQ - Dynamic Accordion\node_modules@voitanos\jest-preset-spfx-react16
node scripts/postinstall.js

JEST PRESET POSTINSTALL STEP 1 of 4...
INFO: Adding Jest configuration file to: ./config/jest.config.json
INFO: jest.config.json not found; creating it
JEST PRESET POSTINSTALL STEP 2 of 4...
INFO: Updating NPM script 'test' to use Jest.
INFO" package.json script/test currently set to default SPFx project; updating to use jest
INFO: package.json scripts updated for Jest testing
.. run "npm test" or "npm test:watch" to run Jest tests
JEST PRESET POSTINSTALL STEP 3 of 4...
INFO: Ensure tsconfig.json includes '@types/jest' in the types property
internal/modules/cjs/loader.js:1109
throw err;
^

SyntaxError: C:\Users\kkittinger\Documents\DevOps Resp\SPFX Development\React\FAQ - Dynamic Accordion\tsconfig.json: Unexpected token ] in JSON at position 632
at parse ()
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1106:22)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (C:\Users\kkittinger\Documents\DevOps Resp\SPFX Development\React\FAQ - Dynamic Accordion\node_modules@voitanos\jest-preset-spfx-react16\scripts\postinstall.js:101:20)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
npm WARN notsup Unsupported engine for write-file-atomic@5.0.0: wanted: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"} (current: {"node":"14.16.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: write-file-atomic@5.0.0
npm WARN notsup Unsupported engine for write-file-atomic@5.0.0: wanted: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"} (current: {"node":"14.16.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: write-file-atomic@5.0.0
npm WARN notsup Unsupported engine for write-file-atomic@5.0.0: wanted: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"} (current: {"node":"14.16.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: write-file-atomic@5.0.0
npm WARN @pnp/sp-clientsvc@1.3.11 requires a peer of @pnp/common@1.3.11 but none is installed. You must install peer dependencies yourself.
npm WARN @pnp/sp-clientsvc@1.3.11 requires a peer of @pnp/logging@1.3.11 but none is installed. You must install peer dependencies yourself.
npm WARN @pnp/sp-clientsvc@1.3.11 requires a peer of @pnp/odata@1.3.11 but none is installed. You must install peer dependencies yourself.
npm WARN @pnp/sp-clientsvc@1.3.11 requires a peer of @pnp/sp@1.3.11 but none is installed. You must install peer dependencies yourself.
npm WARN @pnp/sp-taxonomy@1.3.11 requires a peer of @pnp/logging@1.3.11 but none is installed. You must install peer dependencies yourself.
npm WARN @pnp/sp-taxonomy@1.3.11 requires a peer of @pnp/common@1.3.11 but none is installed. You must install peer dependencies yourself.
npm WARN @pnp/sp-taxonomy@1.3.11 requires a peer of @pnp/odata@1.3.11 but none is installed. You must install peer dependencies yourself.
npm WARN @pnp/sp-taxonomy@1.3.11 requires a peer of @pnp/sp@1.3.11 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN @voitanos/jest-preset-spfx-react16@1.5.0 requires a peer of jest@26.6.3 but none is installed. You must install peer dependencies yourself.
npm WARN ts-jest@26.5.6 requires a peer of jest@>=26 <27 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules@rushstack\typings-generator\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @voitanos/jest-preset-spfx-react16@1.5.0 postinstall: node scripts/postinstall.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @voitanos/jest-preset-spfx-react16@1.5.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

React: 16.13.1
NPM: 6.14.12
Node: 14.16.1
"@microsoft/rush-stack-compiler-3.9": "0.4.47"

@andrewconnell
Copy link
Member

Can you provide some context?

  • what version of SPFx are you using
  • share the contents of tsconfig.json

@Hylar-86
Copy link
Author

Hylar-86 commented Feb 6, 2023

SPFx - 1.14.0

tsconfig.json
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"webpack-env",
"es6-promise",
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src//*.ts",
"src/
/*.tsx"
]
}

@andrewconnell
Copy link
Member

Not sure if that's a copy-paste error or problem that you didn't fence the code in your response, but that's tsconfig.json isn't valid. One thing that stands out: the include array at the end isn't valid... it should be in the format ofsrc/**/*.ts.

Please recheck your tsconfig.

@Hylar-86
Copy link
Author

Hylar-86 commented Feb 7, 2023

Looks like that was a copy paste issues as i double checked and the format in the include is src/**/*.ts and src/**/*.tsx. When i paste it submit is looks like it is eatting the ** so i just attached the file.
tsconfig.zip

@andrewconnell
Copy link
Member

The issue with just pasting code... it's being rendered as markdown. As I said in my last reply, read up on "fenced code blocks": https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

I'll take a look at the issue when I have some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants