preact-cli
preact-cli copied to clipboard
preact watch fails with emacs lock files / dead symbolic links
Do you want to request a feature or report a bug?
bug
What is the current behaviour?
-
$ preact watch
- I can access 127.0.0.1:8080 and use the application :heavy_check_mark:
- After changing a file "file.xyz" in my editor (emacs), a state file is created: ".#file.xyz"
- the preact process crashes:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start:development: `npm run -s dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start:development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2020-05-24T17_29_55_141Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Extract from npm error log:
10 verbose lifecycle [email protected]~start:development: CWD: /home/user/code/project
11 silly lifecycle [email protected]~start:development: Args: [ '-c', 'npm run -s dev' ]
12 silly lifecycle [email protected]~start:development: Returned: code: 1 signal: null
13 info lifecycle [email protected]~start:development: Failed to exec start:development script
14 verbose stack Error: [email protected] start:development: `npm run -s dev`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
14 verbose stack at EventEmitter.emit (events.js:315:20)
14 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
14 verbose stack at ChildProcess.emit (events.js:315:20)
14 verbose stack at maybeClose (internal/child_process.js:1051:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
15 verbose pkgid [email protected]
16 verbose cwd /home/user/code/project
17 verbose Linux 5.6.11-arch1-1
18 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start:development"
19 verbose node v14.3.0
20 verbose npm v6.14.5
21 error code ELIFECYCLE
22 error errno 1
Please paste the results of preact info
here.
Environment Info:
System:
OS: Linux 5.6 Arch Linux
CPU: (4) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Binaries:
Node: 14.3.0 - /usr/bin/node
Yarn: 1.22.4 - /usr/bin/yarn
npm: 6.14.5 - /usr/bin/npm
Browsers:
Firefox: 76.0.1
npmPackages:
preact: ^10.4.4 => 10.4.4
preact-cli: ^3.0.0-rc.10 => 3.0.0-rc.10
preact-render-to-string: ^5.1.4 => 5.1.8
preact-router: ^3.2.1 => 3.2.1
npmGlobalPackages:
preact-cli: 3.0.0-rc.10
** Note ** This happend after upgrading from 2.? to 3.0.0.
I used $ inotifywait -r -m .
to watch for file changes to see what is going on:
./ CREATE .#index.tsx
./ OPEN,ISDIR
./ ACCESS,ISDIR
./ CLOSE_NOWRITE,CLOSE,ISDIR
./ OPEN,ISDIR
./ ACCESS,ISDIR
./ CLOSE_NOWRITE,CLOSE,ISDIR
The .#index.tsx
is a lock file: https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html
This points to [email protected]:boot
which cannot resolved obviously.
With preact watch
running you can emulate the behavior of emacs by creating a dead symlink:
ln -s does_not_exist foo
You should see a message like
✖ ERROR Error: ENOENT: no such file or directory, stat 'foo'
:point_right: As a short-term solution, you can set create-lockfiles to nil in emacs to prevent preact watch
from crashing
This was introduced upstream somewhere in this diff https://github.com/webpack/watchpack/compare/v1.6.1...v1.7.2
I encountered the same bug and manually selected version 1.6.1 in my package-lock.json
file and was able to move on with my day.
Here is the entry for watchpack 1.6.1.
"watchpack": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.1.tgz",
"integrity": "sha512-+IF9hfUFOrYOOaKyfaI7h7dquUIOgyEMoQMLA7OP5FxegKA2+XdXThAZ9TU2kucfhDH7rfMHs1oPYziVGWRnZA==",
"dev": true,
"requires": {
"chokidar": "^2.1.8",
"graceful-fs": "^4.1.2",
"neo-async": "^2.5.0"
}
}
`
If you use yarn
, you can also add this to package.json
:
"resolutions": {
"watchpack": "1.6.1"
},
Does this still happen in the 3.0.0
release?
@developit the problem still happens with preact, 3.0.3