skip to Main Content

I am new in shopfy development. I follow the instruction for shopify theme customization – https://shopify.dev/docs/themes/getting-started/customize

When I run shopify theme dev then an error happens in terminal.

osama@debian:~/works/shopify-dev/OsamaTheme$ shopify theme dev
Error: Command failed with exit code 23: bundle install
There was an error while trying to write to `/usr/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/Gemfile.lock`. It is likely that you need
to grant write permissions for that path.
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 12.3.3

When I run shopify theme dev it should open a preview mode.

My environment details-

THEME CONFIGURATION                
Store                  <STORE_NAME>.myshopify.com
Development Theme ID   #1.........8

TOOLING AND SYSTEM                 
Shopify CLI    3.44.1
OS             linux-amd64
Shell          /bin/bash
Node version   v19.8.1
Ruby version   3.0.0

2

Answers


  1. try with sudo or change permission with sudo chown -R. I had similar problem and I am using debian system – sudo helped sudo shopify theme dev --store

    Login or Signup to reply.
  2. I had this problem too and, after reading Bundler troubleshooting docs, I found out the problem was I had some Bundler versions installed from Gems as regular user. Hopefully (I didn’t check before solving), bundle install was using one of them.

    # This doesn't tell whether each package is installed as root or regular user
    gem list bundler
    bundler (2.4.10, 2.4.7, 2.3.26, 2.3.5, default: 2.2.22)
    
    dpkg -l bundler
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Nome           Versão       Arquitectura Descrição
    +++-==============-============-============-====================================
    ii  bundler        2.3.5-2      all          Manage Ruby application dependencies
    

    My solution was to uninstall all Bundler gems, leaving only the OS provided one

    sudo gem uninstall bundler
    Select gem to uninstall:
     ...
     4. All versions
    > 4
    

    After this, running bundle install asked for my password and successfully installed all gems thru sudo:

    bundle install
    Your user account isn't allowed to install to the system RubyGems.
      ...enter your password and install the bundled gems to RubyGems using sudo.
      Password:       
    ...
    Bundle complete! 13 Gemfile dependencies, 173 gems now installed.
    

    Do not run Bundler with sudo

    Bundler does some actions as root, and some others as regular user. It asks for your sudoer password (if you’re a sudoer) to run root actions as root. If you do sudo bundle install, it does all actions as root, including network ones. This is a obvious vunlerability. Besides, it creates root-owned files where they shouldn’t, making you unable to do further actions as a regular user. So follow advice from Bundler man page: "You should never use sudo bundle install".

    Do not change system directory permissions

    They’re there for a reason. Opening them means creating vulnerable spots no one should want. So we better leave them as they are and solve point issues where they are.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search