gatsby cli develop interrupted by emacs tmp file

Created on 7 Jul 2020  路  19Comments  路  Source: gatsbyjs/gatsby

Description

gatsby-cli command: gatsby develop auto exit becouse of emacs editor tmp file such as .#about.jsx

Steps to reproduce

$: gatsby develop
in emacs: editing About.jsx
$: Error: ENOENT: no such file or directory, stat '/home/dipper/Workspace/video_front_end/src/components/About/.#About.jsx'

Expected result

$: success

Actual result

$: Error: ENOENT: no such file or directory, stat '/home/dipper/Workspace/video_front_end/src/components/About/.#About.jsx'

Environment

```
System:
OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Shell: 5.0.16 - /bin/bash
Binaries:
Node: 10.19.0 - /usr/bin/node
npm: 6.14.5 - /usr/local/bin/npm
Languages:
Python: 2.7.18 - /usr/bin/python
Browsers:
Chrome: 83.0.4103.97
Firefox: 77.0.1
npmPackages:
gatsby: ^2.19.12 => 2.23.21
gatsby-image: ^2.2.40 => 2.4.12
gatsby-plugin-catch-links: ^2.1.25 => 2.3.10
gatsby-plugin-create-client-paths: ^2.2.1 => 2.3.9
gatsby-plugin-feed: ^2.3.27 => 2.5.10
gatsby-plugin-google-analytics: ^2.1.35 => 2.3.10
gatsby-plugin-lodash: ^3.1.20 => 3.3.9
gatsby-plugin-manifest: ^2.2.41 => 2.4.17
gatsby-plugin-material-ui: ^2.1.6 => 2.1.9
gatsby-plugin-netlify-cms: ^4.1.38 => 4.3.10
gatsby-plugin-nprogress: ^2.1.19 => 2.3.9
gatsby-plugin-offline: ^3.0.34 => 3.2.16
gatsby-plugin-react-helmet: ^3.1.22 => 3.3.9
gatsby-plugin-sass: ^2.2.1 => 2.3.10
gatsby-plugin-sharp: ^2.4.5 => 2.6.18
gatsby-plugin-sitemap: ^2.2.27 => 2.4.10
gatsby-plugin-twitter: ^2.1.19 => 2.3.9
gatsby-plugin-typescript: ^2.3.1 => 2.4.13
gatsby-remark-autolink-headers: ^2.1.24 => 2.3.10
gatsby-remark-copy-linked-files: ^2.1.37 => 2.3.10
gatsby-remark-images: ^3.1.44 => 3.3.17
gatsby-remark-prismjs: ^3.3.31 => 3.5.9
gatsby-remark-relative-images: ^0.2.3 => 0.2.3
gatsby-remark-responsive-iframe: ^2.2.32 => 2.4.10
gatsby-source-filesystem: ^2.1.48 => 2.3.18
gatsby-transformer-remark: ^2.6.50 => 2.8.23
gatsby-transformer-sharp: ^2.3.14 => 2.5.10
npmGlobalPackages:
gatsby-cli: 2.12.58


npm log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 info lifecycle [email protected]~dev: [email protected]
7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/dipper/Workspace/video_front_end/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle [email protected]~dev: CWD: /home/dipper/Workspace/video_front_end
10 silly lifecycle [email protected]~dev: Args: [ '-c', 'npm run develop' ]
11 silly lifecycle [email protected]~dev: Returned: code: 1 signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] dev: npm run develop
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/dipper/Workspace/video_front_end
16 verbose Linux 5.4.0-39-generic
17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v10.19.0
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] dev: npm run develop
22 error Exit status 1
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

```

confirmed dev tooling bug

Most helpful comment

ignore tmp files with webpack from: https://github.com/facebook/create-react-app/issues/9056

put in gatsby-node.js in root dir

exports.onCreateWebpackConfig = ({
    stage,
    rules,
    loaders,
    plugins,
    actions,
}) => {
    actions.setWebpackConfig({
        devServer: {
            watchOptions: {
                ignored: /\.#|node_modules|~$/,
            },
        }
    })
};

All 19 comments

have any idea or metaphors?

(Confirmed. Edit a component or template or something and you'll get this.)

 馃樁  11:36:50 (master) benchmarks/mdx2 $ ls -al benchmarks/mdx2/src/pages/.#index.js
lrwxrwxrwx 1 me me 30 Jul  8 11:35 benchmarks/mdx2/src/pages/.#index.js -> [email protected]:1594194121

I guess it's tripping over a file-socket?

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hiya!

This issue has gone quiet. Spooky quiet. ghost

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! musclepurple_heart

i can't use emacs anymore

There's a work around in this issue https://github.com/facebook/create-react-app/issues/9056#issuecomment-633540572

We probably need to ignore this in webpack?

There's a work around in this issue facebook/create-react-app#9056 (comment)

We probably need to ignore this in webpack?

thank you for help, solved temporary
i don't know the issues, i don't have time to figure it out.
but it is more like a file watch bug.

Maybe we can do something like this suggestion;
https://github.com/facebook/create-react-app/issues/9056#issuecomment-639967442

Change the file /node_modules/react-scripts/scripts/start.js

process.on('unhandledRejection', err => {
    const re = /ENOENT: no such file or directory, stat .*\.#.*\.ts/i;
    if (!err.message.match(re)) {
        throw err; 
    }
});

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Another workaround, see: https://stackoverflow.com/a/62571200

You can disable emacs lockfiles locally:

;; .dir-locals.el in the project root
((nil . ((create-lockfiles . nil)))) 

But this isn't really a fix.

ignore tmp files with webpack from: https://github.com/facebook/create-react-app/issues/9056

put in gatsby-node.js in root dir

exports.onCreateWebpackConfig = ({
    stage,
    rules,
    loaders,
    plugins,
    actions,
}) => {
    actions.setWebpackConfig({
        devServer: {
            watchOptions: {
                ignored: /\.#|node_modules|~$/,
            },
        }
    })
};

@rople380 - at first look that seems to work for me, thank you!

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Just to be clear, I don't want this to be left to go stale. The work-around given in https://github.com/gatsbyjs/gatsby/issues/25562#issuecomment-684399348 seems to be doing the job for me, and it should therefore be relatively straightforward to integrate into into gatsby, as I think it is already for certain other file types?

Certainly gatsby develop should not be vulnerable to arbitrary content making it crash spontaneously, and especially so if this is a file created as a matter of course by a fairly major editor.

Two potential solutions we're considering:

  • Add an env flag that ignores files starting with .#
  • Add option to gatsby-source-filesystem to explicitly ignore filenames starting with .#

Anyone want to do a PR?

To clarify, the option to the plugin would be explicitly for this case, not a generic. No need to feature creep here.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

I just ran into the same issue, so commenting to keep it from going stale.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Yes, this is still an issue. I'm using the workaround from above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benstr picture benstr  路  3Comments

magicly picture magicly  路  3Comments

theduke picture theduke  路  3Comments

mikestopcontinues picture mikestopcontinues  路  3Comments

timbrandin picture timbrandin  路  3Comments