X Tutup
The Wayback Machine - https://web.archive.org/web/20201123155723/https://github.com/shelljs/shelljs/issues/1008
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

ShellJSInternalError: fs.existsSync is not a function #1008

Open
catonmat opened this issue Sep 16, 2020 · 1 comment
Open

ShellJSInternalError: fs.existsSync is not a function #1008

catonmat opened this issue Sep 16, 2020 · 1 comment

Comments

@catonmat
Copy link

@catonmat catonmat commented Sep 16, 2020

#46 # Node version (or tell us if you're using electron or some other framework):
Node 14.10
React ^16.11.00
react-scripts 3.4.1

ShellJS version (the most recent version/Github branch you see the bug on):

^0.8.4

Operating system:

OS X 10.15.6

Description of the bug:

I want to execute a simple print command using standard input from inside a React app.
If this is not possible, it would be great to receive feedback on how to do this!
For example, perhaps I can setup a local node server that deploys with the react app and embed shelljs into the node server instead.

Example ShellJS command to reproduce the error:

import React from 'react';
[...]
import shell from 'shelljs';
shell.config.execPath = 'v14.1.0';

[...]
shell.exec(`echo "some text" | lp`);
[...]

// => ShellJSInternalError: fs.existsSync is not a function
// writeableDir
// node_modules/shelljs/src/tempdir.js:12
// _tempDir
// node_modules/shelljs/src/tempdir.js:44
// execSync
// node_modules/shelljs/src/exec.js:24
// _exec
// node_modules/shelljs/src/exec.js:205
// exec
// node_modules/shelljs/src/common.js:335
@nfischer
Copy link
Member

@nfischer nfischer commented Oct 12, 2020

Node docs suggest the API still exists, not sure you would get this error: https://nodejs.org/api/fs.html#fs_fs_existssync_path

shell.config.execPath = 'v14.1.0';

This isn't the right way to configure this. This needs to be the full path to your node binary (or you can leave it unset, in which case ShellJS usually picks the right thing). See https://github.com/shelljs/shelljs/wiki/Electron-compatibility. Does the bug go away if you comment out this line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
X Tutup