Parcel: Error to Build basic example Parcel 1.8.1

Created on 25 May 2018  ยท  4Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report


I try to build a POC with parcel, with simple proyects only javascript with console.log. When build with parcel, the console throw me this error, but i remove and install node_modules, the error lib change.

I try to install with yarn and npm, but throw the error.

I reply the same code with parcel-bundle 1.7.x and works!! but 1.8.x not work.

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

{
  "name": "code_maquetacion",
  "version": "1.0.0",
  "description": "Maqueta de Api Connect",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "git+https://[email protected]/krbaio3/code_maquetacion.git"
  },
  "scripts": {
    "build": "rimraf dist && parcel ./src/index.html",
    "build:prod": "rimraf dist && parcel build ./src/index.html",
    "start": "rimraf dist && parcel ./src/index.html --open",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "KrBaIO3 <[email protected]>",
  "license": "MIT",
  "private": true,
  "homepage": "https://bitbucket.org/krbaio3/code_maquetacion#readme",
  "devDependencies": {
    "node-sass": "^4.9.0",
    "parcel-bundler": "~1.8.1",
    "rimraf": "^2.6.2"
  },
  "dependencies": {}
}

๐Ÿค” Expected Behavior

Building

๐Ÿ˜ฏ Current Behavior

jorge@code-solutions-ThinkPad-L380:~/Workspace/code-maquetacion$ yarn start
yarn run v1.7.0
$ rimraf dist && parcel ./src/index.html --open
Server running at http://localhost:1234
โณ  Building hmr-runtime.js...
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: watch /home/jorge/Workspace/code-maquetacion/node_modules/htmlnano/test.js ENOSPC
    at _errnoException (util.js:992:11)
    at FSWatcher.start (fs.js:1382:19)
    at Object.fs.watch (fs.js:1408:11)
    at createFsWatchInstance (/home/jorge/Workspace/code-maquetacion/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/jorge/Workspace/code-maquetacion/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/jorge/Workspace/code-maquetacion/node_modules/chokidar/lib/nodefs-handler.js:229:14)
    at FSWatcher.NodeFsHandler._handleFile (/home/jorge/Workspace/code-maquetacion/node_modules/chokidar/lib/nodefs-handler.js:256:21)
    at FSWatcher.<anonymous> (/home/jorge/Workspacecode-maquetacion/node_modules/chokidar/lib/nodefs-handler.js:474:21)
    at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

๐Ÿ’ Possible Solution

๐Ÿ”ฆ Contex

๐Ÿ’ป Code Sample

<html>

<body>
    <script src="./index.js"></script>
</body>

</html>
const sampleNumber = 1;
console.log(`Hello from sample ${sampleNumber}`);

๐ŸŒ Your Environment


Parcel KO

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.8.1
| Node | 8.11.2
| npm/Yarn | 6.1.0 / 1.7.0
| Operating System | Ubuntu 17.10

Parcel OK

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.7.1
| Node | 8.11.2
| npm/Yarn | 6.1.0 / 1.7.0
| Operating System | Ubuntu 17.10

Most helpful comment

It's a well known error with Linux and watchers.

Solution :

Run the below command to avoid ENOSPC:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
For Arch Linux add this line to /etc/sysctl.d/99-sysctl.conf:

fs.inotify.max_user_watches=524288
Then execute:

sysctl --system
This will also persist across reboots.

https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers#the-technical-details

We should probably give a better error message for Linux users.

All 4 comments

It's a well known error with Linux and watchers.

Solution :

Run the below command to avoid ENOSPC:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
For Arch Linux add this line to /etc/sysctl.d/99-sysctl.conf:

fs.inotify.max_user_watches=524288
Then execute:

sysctl --system
This will also persist across reboots.

https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers#the-technical-details

We should probably give a better error message for Linux users.

These errors no longer appear in the current master version @fathyb due to the watcher worker.
So showing this error will probably no longer be possible, we can probably do a PR to chokidar though.

Thanks @fathyb !!

It works well!

Why are things inside node_modules being watched for changes?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tarepan picture tarepan  ยท  46Comments

garrydzeng picture garrydzeng  ยท  95Comments

devcati picture devcati  ยท  45Comments

mjrjoh picture mjrjoh  ยท  40Comments

devongovett picture devongovett  ยท  49Comments