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

UnhandledPromiseRejectionWarning when building. #11

Closed
ejnaren opened this issue Dec 5, 2017 · 18 comments
Closed

UnhandledPromiseRejectionWarning when building. #11

ejnaren opened this issue Dec 5, 2017 · 18 comments

Comments

@ejnaren
Copy link

ejnaren commented Dec 5, 2017

Hi. As many others I am very excited for the work you are doing here. Badly needed.
I have stumpled upon a slight problem building even just the simplest html file:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <p>Hello...</p>
  </body>
</html>

After running parcel index.html, the "dist" folder is created but it is empty.
The following is the console errors:

Server running at http://localhost:1234
⏳  Building index.html...
(node:11164) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3001): RangeError: Maximum call stack size exceeded
(node:11164) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@Nedlinin
Copy link

Nedlinin commented Dec 5, 2017

Confirming this happens to me as well. Node 9.1.0

@devongovett
Copy link
Member

hmm, is this node 9 specific? I've tested against node 8 so far.

@ejnaren
Copy link
Author

ejnaren commented Dec 5, 2017 via email

@hinell
Copy link

hinell commented Dec 5, 2017

Same here. I just followed get-started guide as it failed. 😢
Dist folder is also created.

parcel --version => 1.0.1
node --version => v9.2.0
platform => windows 10 pro x64

Error

Server running at http://localhost:1234
⏳  Building index.html...
(node:2520) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3001): 
RangeError: Maximum call stack size exceeded
(node:2520) [DEP0018] DeprecationWarning: 
Unhandled promise rejections are deprecated. In the future,
promise rejections that are not handled will terminate
the Node.js process with a non-zero exit code.

Steps to reproduce:

// module.js
export function helloWorld () {console.log('Hello World!');};
// index.js
import { helloWorld } from './module';
helloWorld();
    <script src="index.js"></script>

Command

$ parcel index.html

@mwarger
Copy link

mwarger commented Dec 5, 2017

I followed the getting started and had the same results. Sample repo here: https://github.com/mwarger/parcel-getting-started-windows

Windows 10

parcel 1.0.1
node 9.2.0

@pke
Copy link
Contributor

pke commented Dec 5, 2017

This happens even with the simplest html file and no JS involved:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Test</title>
</head>
<body>
  <div id="app"/>
  
</body>
</html>

node v7.10.0
parcel-bundler@1.0.1

@itsMapleLeaf
Copy link
Contributor

itsMapleLeaf commented Dec 6, 2017

I get the same error. When I try to do a build on the Windows subsystem for Linux, the error goes away (but I get a new one, related: #8)

🚨  /mnt/d/Projects/parcel-test/index.js: MOZ_TO_ME[node.type] is not a function
    at from_moz (eval at <anonymous> (/mnt/d/Projects/parcel-test/node_modules/uglify-js/tools/node.js:21:1), <anonymous>:10753:54)
    at Object.From_Moz_AssignmentExpression [as AssignmentExpression] (eval at map (eval at <anonymous> (/mnt/d/Projects/parcel-test/node_modules/uglify-js/tools/node.js:21:1)), <anonymous>:9:8)    at from_moz (eval at <anonymous> (/mnt/d/Projects/parcel-test/node_modules/uglify-js/tools/node.js:21:1), <anonymous>:10753:54)
    at Object.ExpressionStatement (eval at <anonymous> (/mnt/d/Projects/parcel-test/node_modules/uglify-js/tools/node.js:21:1), <anonymous>:10292:23)
    at from_moz (eval at <anonymous> (/mnt/d/Projects/parcel-test/node_modules/uglify-js/tools/node.js:21:1), <anonymous>:10753:54)
    at Array.map (<anonymous>)
    at Object.Program (eval at <anonymous> (/mnt/d/Projects/parcel-test/node_modules/uglify-js/tools/node.js:21:1), <anonymous>:10267:51)
    at from_moz (eval at <anonymous> (/mnt/d/Projects/parcel-test/node_modules/uglify-js/tools/node.js:21:1), <anonymous>:10753:54)
    at Function.AST_Node.from_mozilla_ast (eval at <anonymous> (/mnt/d/Projects/parcel-test/node_modules/uglify-js/tools/node.js:21:1), <anonymous>:10761:19)
    at module.exports (/mnt/d/Projects/parcel-test/node_modules/parcel-bundler/src/transforms/uglify.js:10:22)

So it does appear to be a Windows issue.

For people on Windows, WSL seems like a workaround for the time being. I got it to build with the --no-minify flag.

@devongovett
Copy link
Member

hmm, seems like a windows issue 😢? I can try to setup a vm to test, but would be great if someone could dig into this a bit and get more info on the errors being logged there (e.g. what promise is being rejected, etc.). Thanks in advance for your help! 😄

@hyrious
Copy link

hyrious commented Dec 6, 2017

@devongovett It turns out that src/utils/config.js#L6 got recursively calling itself, which causes Maximum call stack size exceeded. Not find out how to solve it yet.
I got this information by mocha, here is the stack trace:

test/css.js#L8 in describe('css', function () {

    let b = await bundle(__dirname + '/integration/css/index.js');

src/Bundler.js#L275 in async loadAsset(asset) {

      processed = await this.farm.run(asset.name, asset.package, this.options);

src/WorkerFarm.js#L63 in async run(...args) {

      return this.localWorker.run(...args);

src/worker.js#L20 in exports.run = async function (path, pkg, options, callback) {

    await asset.process();

src/assets/JSAsset.js#L72 in async pretransform() {

    await babel(this);

src/transforms/babel.js#L39 in async function shouldTransform(asset) {

  let babelrc = await config.resolve(asset.name, ['.babelrc', '.babelrc.js']);

src/utils/config.js#L25 in async function resolve(filepath, filenames, root = '/') {

  return resolve(filepath, filenames, root);

@e2goon
Copy link

e2goon commented Dec 6, 2017

src/utils/config.js#L25

resolve(filepath, filenames, root);

Let's look at the return value in Windows and Mac environments.

This is windows screenshot

image

@hyrious
Copy link

hyrious commented Dec 6, 2017

In src/utils/config.js#L10, I did:
replace filepath === root with filepath === root || filepath === path.dirname(filepath),
then I run test again, got these:

> mocha

css
√ should produce two bundles when importing a CSS file (2301ms)
√ should support loading a CSS bundle along side dynamic imports (1234ms)
√ should support importing CSS from a CSS file
√ should support linking to assets with url() from CSS
1) should support transforming with postcss
√ should minify CSS in production mode (325ms)

fs
√ should inline a file as a string
√ should inline a file as a buffer (113ms)
√ should inline a file with fs require alias
√ should inline a file with fs require inline
√ should inline a file with fs require assignment
√ should inline a file with fs require assignment alias
√ should inline a file with fs require destructure
√ should inline a file with fs require destructure assignment

glob
2) should require a glob of files
3) should require nested directories with a glob
4) should support importing a glob of CSS files

hmr
√ should emit an HMR update for the file that changed (207ms)
5) "before each" hook for "should emit an HMR update for all new dependencies along with the changed file"

14 passing (5s)
5 failing

  1. css
    should support transforming with postcss:

    AssertionError [ERR_ASSERTION]: '_index_1cehs_1' == '_index_1ezyc_1'

    • expected - actual

    -_index_1cehs_1
    +_index_1ezyc_1

    at Context.<anonymous> (test\css.js:119:12)
    at <anonymous>

  2. glob
    should require a glob of files:
    TypeError: Cannot read property 'name' of undefined
    at assertBundleTree (test\utils.js:63:39)
    at Context.<anonymous> (test\glob.js:9:5)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

  3. glob
    should require nested directories with a glob:
    TypeError: Cannot read property 'name' of undefined
    at assertBundleTree (test\utils.js:63:39)
    at Context.<anonymous> (test\glob.js:23:5)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

  4. glob
    should support importing a glob of CSS files:
    TypeError: Cannot read property 'name' of undefined
    at assertBundleTree (test\utils.js:63:39)
    at Context.<anonymous> (test\glob.js:37:5)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

  5. "before each" hook for "should emit an HMR update for all new dependencies along with the changed file":
    Error: ENOTEMPTY: directory not empty, rmdir 'D:\inbox\parcel\test\dist'
    at Object.fs.rmdirSync (fs.js:846:18)
    at rmkidsSync (node_modules\rimraf\rimraf.js:356:25)
    at rmdirSync (node_modules\rimraf\rimraf.js:334:7)
    at Function.rimrafSync [as sync] (node_modules\rimraf\rimraf.js:304:9)
    at Context.<anonymous> (test\utils.js:10:10)

@parcel-bundler parcel-bundler deleted a comment from e2goon Dec 6, 2017
@jamiebuilds
Copy link
Member

jamiebuilds commented Dec 6, 2017

It's probably that root is /, but on Window file paths are split up by \ and I think the root of the file system has a prefix?

@StarpTech
Copy link
Contributor

StarpTech commented Dec 6, 2017

@thejameskyle exactly, I created a PR #48 which fix it but test are still failing. We should integrate CI.

@lifeart
Copy link

lifeart commented Dec 6, 2017

Same for node v7.9.0, win10 x64, parcel 1.2

devongovett pushed a commit that referenced this issue Dec 6, 2017
* parse root path, add cross-env for windows and unix support

* nromalize paths
@hyingreborn
Copy link

when we can use the version 1.0.3 ?

@devongovett
Copy link
Member

Published v1.0.3.

@burlesona
Copy link

Just for what it's worth I got this exact same error trying parcel on MacOS High Sierra with a minimum HTML page and Node 6x latest. Looks like Parcel requires >= 8x, as switching from Boron to Carbon fixed it. Would probably be worth noting this on the docs, as I couldn't find anything indicating which version of Node was required.

devongovett pushed a commit that referenced this issue Oct 15, 2018
* parse root path, add cross-env for windows and unix support

* nromalize paths
devongovett pushed a commit that referenced this issue Oct 15, 2018
* parse root path, add cross-env for windows and unix support

* nromalize paths
@cdll
Copy link

cdll commented Oct 11, 2019

same issue here with

OS: macOS 10.15(13-inch, 2017, i5+8+256)
nodejs: v10.15.3
parcel-bundler: 1.12.4

----- updates: -----
found that issue above cause my code of page-main.js:

//deps: 
import Vue from 'vue'

//main: 
if(`missing required search query`) return false
const vm= new Vue({
  //...ANY CODE
})

and it worked for me when i removed if(`missing required search query`) return false this line.
maybe i need some work around code~ sorry for bothering here~ :P

padmaia added a commit that referenced this issue Jun 5, 2020
Enable workerize

* Use unique keys in all workerize assets and do not process node_modules

* Configure workerize transformer

* Inline workerize workers

* Add transformer to config package.json

Approved-by: Will Binns-Smith
gorakong pushed a commit that referenced this issue Apr 29, 2021
Merge v2 2021-01-05

Approved-by: Gora Kong
Approved-by: Agnieszka Gawrys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests