Open-Assistant icon indicating copy to clipboard operation
Open-Assistant copied to clipboard

pre-commit fails on "Lint website" `npm ERR! SyntaxError: ...\data\rules.json: Unterminated string in JSON at position 71629`

Open andrewm4894 opened this issue 2 years ago • 4 comments

Trying to run pre-commit run --all-files and getting this error. On windows using a powershell terminal from vscode.

Making issue in case anyone else hits it.

Wondering if some node version stuff maybe.

image
PS C:\Users\andre\Documents\repos\Open-Assistant> pre-commit run --all-files
trim trailing whitespace.................................................Passed
check python ast.........................................................Passed
check yaml...............................................................Passed
check json...............................................................Passed
check for case conflicts.................................................Passed
detect private key.......................................................Passed
fix python encoding pragma...............................................Passed
forbid submodules....................................(no files to check)Skipped
mixed line ending........................................................Passed
fix requirements.txt.....................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check BOM - deprecated: use fix-byte-order-marker........................Passed
check for broken symlinks............................(no files to check)Skipped
check for merge conflicts................................................Passed
check for added large files..............................................Passed
fix end of files.........................................................Passed
black....................................................................Passed
flake8...................................................................Passed
isort....................................................................Passed
prettier.................................................................Passed
Lint website.............................................................Failed
- hook id: next-lint-website
- exit code: 1

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"18.2.0" from the root project
npm WARN   133 more (@chakra-ui/accordion, @chakra-ui/alert, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.4 || ^17.0.0" from [email protected]
npm WARN node_modules/@storybook/addon-actions/node_modules/react-inspector
npm WARN   react-inspector@"^5.1.0" from @storybook/[email protected]
npm WARN   node_modules/@storybook/addon-actions
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.8.4 || ^17.0.0" from [email protected]
npm WARN   node_modules/@storybook/addon-actions/node_modules/react-inspector
npm WARN     react-inspector@"^5.1.0" from @storybook/[email protected]
npm WARN     node_modules/@storybook/addon-actions
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @mdx-js/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"18.2.0" from the root project
npm WARN   133 more (@chakra-ui/accordion, @chakra-ui/alert, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.13.1 || ^17.0.0" from @mdx-js/[email protected]
npm WARN node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
npm WARN   @mdx-js/react@"^1.6.22" from @storybook/[email protected]
npm WARN   node_modules/@storybook/addon-docs
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.13.1 || ^17.0.0" from @mdx-js/[email protected]
npm WARN   node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
npm WARN     @mdx-js/react@"^1.6.22" from @storybook/[email protected]
npm WARN     node_modules/@storybook/addon-docs
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"18.2.0" from the root project
npm WARN   133 more (@chakra-ui/accordion, @chakra-ui/alert, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from [email protected]
npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN   react-element-to-jsx-string@"^14.3.4" from @storybook/[email protected]
npm WARN   node_modules/@storybook/react
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from [email protected]
npm WARN   node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN     react-element-to-jsx-string@"^14.3.4" from @storybook/[email protected]
npm WARN     node_modules/@storybook/react
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN   react-dom@"18.2.0" from the root project
npm WARN   41 more (@chakra-ui/modal, @chakra-ui/portal, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from [email protected]
npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN   react-element-to-jsx-string@"^14.3.4" from @storybook/[email protected]
npm WARN   node_modules/@storybook/react
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1" from [email protected]        
npm WARN   node_modules/@storybook/react/node_modules/react-element-to-jsx-string
npm WARN     react-element-to-jsx-string@"^14.3.4" from @storybook/[email protected]
npm WARN     node_modules/@storybook/react
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '^12.19.0 || ^14.15.0 || ^16.13.0 || ^18.12.0' },
npm WARN EBADENGINE   current: { node: 'v19.3.0', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\@prisma\\engines', 
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\@prisma\engines'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\@prisma\\engines'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\@prisma\\client',  
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\@prisma\client'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\@prisma\\client'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\@prisma\\client',  
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\@prisma\client'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\@prisma\\client'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\@prisma\\engines', 
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\@prisma\engines'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\@prisma\\engines'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\next',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\next\dist\compiled'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\next\\dist\\compiled'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\sharp',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\sharp\vendor\8.13.3\win32-x64'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\andre\\Documents\\repos\\Open-Assistant\\website\\node_modules\\sharp\\vendor\\8.13.3\\win32-x64'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\cypress
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node index.js --exec install
npm ERR! node: internal/modules/cjs/loader:1289
npm ERR!     throw err;
npm ERR!     ^
npm ERR!
npm ERR! SyntaxError: C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\psl\data\rules.json: Unterminated string in JSON at position 71629
npm ERR!     at parse (<anonymous>)
npm ERR!     at Module._extensions..json (node:internal/modules/cjs/loader:1286:39)
npm ERR!     at Module.load (node: internal/modules/cjs/loader:1081:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:922:12)
npm ERR!     at Module.require (node: internal/modules/cjs/loader:1105:19)
npm ERR!     at require (node: internal/modules/cjs/helpers:103:18)
npm ERR!     at Object.<anonymous> (C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\psl\index.js:14:19)
npm ERR!     at Module._compile (node: internal/modules/cjs/loader:1218:14)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1081:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:922:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1105:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:103:18)
npm ERR!     at Object.<anonymous> (C:\Users\andre\Documents\repos\Open-Assistant\website\node_modules\tough-cookie\lib\pubsuffix-psl.js:32:11)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1218:14)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
npm ERR!
npm ERR! Node.js v19.3.0

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\andre\AppData\Local\npm-cache\_logs\2023-01-02T15_42_28_697Z-debug-0.log

andrewm4894 avatar Jan 02 '23 15:01 andrewm4894

does anyone else get this problem? is it a windows problem?

yk avatar Jan 02 '23 17:01 yk

Tried pre-commit run --all-files on macOS Ventura 13.1 just now with the latest and didn't get this failure.

audreyfeldroy avatar Jan 02 '23 21:01 audreyfeldroy

I'm not sure, but it seems to be caused by locking files or folders in Windows. The common cause of locking is some process that is using this file/folder, such as anti malware software, open terminal, etc. Here are the ways how people solved this issue: https://github.com/npm/npm/issues/13461 https://stackoverflow.com/questions/55212864/error-ebusy-resource-busy-or-locked-rmdir

Vechtomov avatar Jan 06 '23 17:01 Vechtomov

I get it on windows. But usually since it runs last it fixes the other checks first and has not blocked me yet.

Has been ok recently though. Will try see if I can figure out how to make it reproducible.

andrewm4894 avatar Jan 06 '23 19:01 andrewm4894

Is this still an issue? if not, can we close it?

AbdBarho avatar Jan 21 '23 11:01 AbdBarho