Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is react-scripts trying access my .steampath? Why? #9156

Comments

@ghost
Copy link

ghost commented Jun 15, 2020

Failed to compile.

./src/containers/Preview/layout.tsx
Attempted import error: 'react-svg' does not contain a default export (imported as 'ReactSVG').
/home/rawieo/[redacted]/node_modules/react-scripts/scripts/start.js:19
  throw err;
  ^

[Error: ENOENT: no such file or directory, stat '/home/rawieo/.steampath'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/home/rawieo/.steampath'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

react-scripts-steampath

react-scripts version is 3.4.1

@petetnt
Copy link
Contributor

petetnt commented Jun 15, 2020

I wonder if you have a node_modules folder under your home root? Sounds like the react-svg import is resolving to some totally wrong folder due to the NodeJS resolution algorithm

@ghost
Copy link
Author

ghost commented Jun 16, 2020

That does not seem to be the case. But I believe it might be true that some dependency is trying to access .steampath. I can not, however, successfully replicate the problem. Though given numerous security vulnerabilities found in node, that does not seem implausible.

Could running node in a docker container help avoid those situations?

@cullenr
Copy link

cullenr commented Jun 17, 2020

I also had this issue today, it surfaced when one of my JS imports was not installed (redux). Adding the dependency fixed the issue. When the dependency was absent from the node_modules directory, something (i didn't dig far enough) would stat my entire home directory. With the dependency present the ~ directory was left alone.

Incidentally, on my machine the file .steampath is actually a broken symlink which is why stat failed.

@petetnt
Copy link
Contributor

petetnt commented Jun 18, 2020

@Rawieo I think @cullenr has it right, .steampath is a broken symlink.

When the dependency was absent from the node_modules directory, something (i didn't dig far enough) would stat my entire home directory

Yes, this is how Node module resolution algorithm works. It backs off folders until it finds the module and then fails (we warn about this with the core CRA modules too).

Closing this as answered, but feel free to ask any other questions too :)

Now that I looked it closer (the .steampath threw me off the loop :)), the other issue is that you should be using the named export from ReactSVG instead of the default one

- import ReactSVG from 'react-svg';
+ import { ReactSVG } from 'react-svg';

@petetnt petetnt closed this as completed Jun 18, 2020
@ghost
Copy link
Author

ghost commented Jun 18, 2020

It backs off folders until it finds the module

I sure am not comfortable with it even leaving project directory, let alone stating anything.

Running the project inside docker container could help (at least hypothetically) avoid security risks, right?

@lock lock bot locked and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.