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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why are there no parentheses after the catch statement #42

Closed
nieyuyao opened this issue Aug 20, 2020 · 6 comments
Closed

Why are there no parentheses after the catch statement #42

nieyuyao opened this issue Aug 20, 2020 · 6 comments

Comments

@nieyuyao
Copy link

I don鈥檛 know if this is a new way of writing, but there will be an error without parentheses 馃槺

@ShachMaT
Copy link

I don鈥檛 know if this is a new way of writing, but there will be an error without parentheses

Just to be specific, you mean this:

const run = async (fn, resolve, ...args) => {
    activeCount++;

    // TODO: Get rid of 'pTry'. It's not needed anymore.
    const result = pTry(fn, ...args);

    resolve(result);

    try {
        await result;
    } catch {}
        next();
};

Should be that:

const run = async (fn, resolve, ...args) => {
    activeCount++;

    // TODO: Get rid of 'pTry'. It's not needed anymore.
    const result = pTry(fn, ...args);

    resolve(result);

    try {
        await result;
    } catch (e) {}
        next();
};

Otherwise it cause this:

/node_modules/copy-webpack-plugin/node_modules/p-limit/index.js:30
		} catch {}
		        ^

SyntaxError: Unexpected token {
    at NativeCompileCache._moduleCompile (/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
    at Module._compile (/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/node_modules/copy-webpack-plugin/dist/index.js:10:38)
    at Module._compile (/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/node_modules/copy-webpack-plugin/dist/cjs.js:3:16)
    at Module._compile (/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/webpack/webpack.config.prod.js:7:27)
    at Module._compile (/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paytel-frontend@1.0.0 build:production: `cross-env NODE_ENV=production webpack --config webpack/webpack.config.prod.js --colors`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the paytel-frontend@1.0.0 build:production script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@nieyuyao nieyuyao reopened this Aug 20, 2020
@nieyuyao
Copy link
Author

I don鈥檛 know if this is a new way of writing, but there will be an error without parentheses

Just to be specific, you mean this:

const run = async (fn, resolve, ...args) => {
    activeCount++;

    // TODO: Get rid of 'pTry'. It's not needed anymore.
    const result = pTry(fn, ...args);

    resolve(result);

    try {
        await result;
    } catch {}
        next();
};

Should be that:

const run = async (fn, resolve, ...args) => {
    activeCount++;

    // TODO: Get rid of 'pTry'. It's not needed anymore.
    const result = pTry(fn, ...args);

    resolve(result);

    try {
        await result;
    } catch (e) {}
        next();
};

Otherwise it cause this:

/node_modules/copy-webpack-plugin/node_modules/p-limit/index.js:30
		} catch {}
		        ^

SyntaxError: Unexpected token {
    at NativeCompileCache._moduleCompile (/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
    at Module._compile (/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/node_modules/copy-webpack-plugin/dist/index.js:10:38)
    at Module._compile (/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/node_modules/copy-webpack-plugin/dist/cjs.js:3:16)
    at Module._compile (/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/webpack/webpack.config.prod.js:7:27)
    at Module._compile (/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paytel-frontend@1.0.0 build:production: `cross-env NODE_ENV=production webpack --config webpack/webpack.config.prod.js --colors`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the paytel-frontend@1.0.0 build:production script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Yes, the problem I encountered is this error !

@ShachMaT
Copy link

ShachMaT commented Aug 20, 2020

Okay so while i encountered this error running Node v8.17 after installing v12 everything is fine.

Try updating Node or using NVM to use different versions of Node.

Edit: In code view you can see comment that states that package require Node v10 or newer. I think this should be clearly stated in readme.
Also, also, i wonder why when running npm install there is no warning or error when running Node older than v10

@sindresorhus
Copy link
Owner

Duplicate of #33

@sindresorhus sindresorhus marked this as a duplicate of #33 Aug 20, 2020
@sindresorhus
Copy link
Owner

Also, also, i wonder why when running npm install there is no warning or error when running Node older than v10

That would be something to bring up on https://github.com/npm/cli/issues

@sindresorhus
Copy link
Owner

In code view you can see comment that states that package require Node v10 or newer. I think this should be clearly stated in readme.

It's defined in package.json in pretty much all npm packages. That's just how it works. I don't intend to duplicate that information in multiple places.

Repository owner locked as resolved and limited conversation to collaborators Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants