Skip to content

fix: add scripts field if not present#1338

Merged
typicode merged 2 commits intotypicode:mainfrom
chalkygames123:fix/scripts-prepare
Jan 25, 2024
Merged

fix: add scripts field if not present#1338
typicode merged 2 commits intotypicode:mainfrom
chalkygames123:fix/scripts-prepare

Conversation

@chalkygames123
Copy link
Contributor

@chalkygames123 chalkygames123 commented Jan 25, 2024

Fixed an error that occurs on installation if the scripts field is not present in package.json.

$ npx husky init
Need to install the following packages:
husky@9.0.1
Ok to proceed? (y) 
file:///Users/takuya/.npm/_npx/0d92fdd791cc1044/node_modules/husky/bin.js:10
  d.scripts.prepare = 'husky'
                    ^

TypeError: Cannot set properties of undefined (setting 'prepare')
    at file:///Users/takuya/.npm/_npx/0d92fdd791cc1044/node_modules/husky/bin.js:10:21
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12)

Node.js v21.4.0

@typicode
Copy link
Owner

Thank you

@typicode typicode merged commit d9941e2 into typicode:main Jan 25, 2024
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

Successfully merging this pull request may close these issues.

2 participants