Shopify CLI deletes package.json?

MadeByField
New Member
4 0 0

Hi,

Does anybody know why the `shopify theme pull` command from the Shopify CLI deletes the local `package.json` file? It leaves the `webpack.config.js` and other similar files. They’re all in the root of the project.

Many thanks,

Dave

0 Likes
rabraham
New Member
1 0 0

Hi Dave,

I encountered the same issue and was able to resolve it by using the following command

shopify theme pull --nodelete

That ensures that no local files are squashed in the sync.

Additionally, I recommend creating a .shopifyignore file where you can include all of your non-theme files such as package.json, package-lock, node_modules dir, webpack.config.js etc. The CLI will ignore these files when pushing/pulling which speeds up the actions and avoids problems like the one you're describing.

https://shopify.dev/themes/tools/cli/theme-commands 

https://shopify.dev/themes/tools/cli#excluding-files-from-shopify-cli 

Hope that helps,

Ryan

0 Likes