Giter Site home page Giter Site logo

Comments (3)

SethFalco avatar SethFalco commented on June 10, 2024

I've been unable to reproduce this on Debian (Linux). I get the same error as you if the file indeed does not exist, but if I create the file, everything works as intended.

Can you please try the following and share the result, just to confirm 100% that this is indeed the scenario you've encountered:

(
  # create a temp directory and cd to it (usually /tmp)
  cd $(mktemp -d)
  # create a mock svg
  echo '<svg></svg>' > original.svg
  # optimize the svg with svgo
  npx svgo@latest original.svg
)

from svgo.

retyui avatar retyui commented on June 10, 2024

you right from tmp folder it works,

 npx svgo@latest original.svg                                                    
 --- xdebug {
  cwd: '/private/var/folders/_z/vx08z2b93ylfqdxv3n2hp7qm0000gp/T/tmp.ALluj36Grh',
  file: 'original.svg',
  __dirname: '/Users/i/.npm/_npx/2be8efd978f68697/node_modules/svgo/lib/svgo'
}

original.svg:
Done in 3 ms!
0.006 KiB - 0% = 0.006 KiB

but if I run it from my yarn monorepo project

  • file: /Users/i/all_work/ck/dtv/app/libs/shared-icons/SVGs/search.svg
cd /Users/i/all_work/ck/dtv/app/libs/shared-icons/SVGs
npx svgo@latest search.svg          
                           
 --- xdebug {
  cwd: '/Users/i/all_work/ck/dtv/app/libs/shared-icons',
  file: 'search.svg',
  __dirname: '/Users/i/.npm/_npx/2be8efd978f68697/node_modules/svgo/lib/svgo'
}
Error: Error: no such file or directory 'search.svg'.
    at checkOptimizeFileError (/Users/i/.npm/_npx/2be8efd978f68697/node_modules/svgo/lib/svgo/coa.js:497:7)
    at /Users/i/.npm/_npx/2be8efd978f68697/node_modules/svgo/lib/svgo/coa.js:378:16
    at async Promise.all (index 0)
    at async Command.action (/Users/i/.npm/_npx/2be8efd978f68697/node_modules/svgo/lib/svgo/coa.js:262:7)
    at async Promise.all (index 0)

from svgo.

retyui avatar retyui commented on June 10, 2024

so the problem in case of monorepo process.cwd() is /Users/i/all_work/ck/dtv/app/libs/shared-icons/

  • but expected to be /Users/i/all_work/ck/dtv/app/libs/shared-icons/SVGs

from svgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.