Skip to content
This repository has been archived by the owner on Feb 17, 2019. It is now read-only.

Experimental feature warning #12

Closed
billc3012 opened this issue Dec 1, 2017 · 13 comments
Closed

Experimental feature warning #12

billc3012 opened this issue Dec 1, 2017 · 13 comments

Comments

@billc3012
Copy link

When running my N-API code I get this warning

(node:21984) Warning: N-API is an experimental feature and could change at any time.

This is a nuisance. Can we have an API call to disable the warning message if we dont want it ?

By the way, I like N-API

@mhdawson
Copy link
Member

mhdawson commented Dec 1, 2017

Can you use --no-warnings ? That should suppress the warning along with all others.

I guess you were hoping to be able to disable it for users of your module ?

@billc3012
Copy link
Author

billc3012 commented Dec 1, 2017 via email

@webern
Copy link

webern commented Jul 13, 2018

I would also like to suppress this warning. It served it's purpose, I understand that I am using an experimental feature, but I am tired of the clutter. Thanks.

@mhdawson
Copy link
Member

mhdawson commented Jul 16, 2018

@webern my guess is that you are using 8.x, right?

In 6.x it is still doc experimental but there is no longer a warning
In 10.x and higher -> stable no warning
In 8.x -> just waiting for next semverMinor (see nodejs/node#21593). I've already backported the change to remove the warning, just waiting for the release :)

@webern
Copy link

webern commented Jul 16, 2018 via email

@mhdawson
Copy link
Member

Since 9.x is no longer supported we'd not be updating it there. I meant 8.x with 8.12 being the semVer minor release that we are waiting on.

@webern
Copy link

webern commented Aug 12, 2018

Thank you for this info, I resolved the issue by updating my project to 10.7. This issue can be closed.

@mhdawson
Copy link
Member

Closing

@jukefr
Copy link

jukefr commented Nov 5, 2018

Is there any way to make this an environment variable of some sorts ?

I am currently writing a unix executable along these lines

#!/usr/bin/env node
const fs = require('fs').promises
// more logic...

So passing the argument in this case is not an option.

EDIT: nodejs/node#10842 feature was already requested and merged apparently

@ancms2600
Copy link

In case it was not clear, if you are on the lts/carbon 8.x branch, you can stay on that major version just upgrade the minor version to something >= 8.12 to resolve this warning.

@BananaAcid
Copy link

BananaAcid commented Feb 10, 2019

@jukefr another shebang line might help:

#!/bin/sh
':' //; exec "$(command -v node)" "--experimental-modules" "--no-warnings" "$0" "$@"

import fsOrig from 'fs';
const fs = fsOrig.promises;

(async () => {
  let files = await fs.readdir( process.cwd() );
  console.log( files );
})().catch(console.error);

I coded this here,to test this case.

  • $(command -v node) finds the executable's full path (do not use which), passes it to exec, since exec can use environment variables (shebang can not), and executes it with all params
  • env can only take ONE parameter, so this second line is needed.
  • $0 is the script (first param), $@ all the other manually passed ones from the command line
  • works with WSL ;)

@ackvf
Copy link

ackvf commented Feb 14, 2019

I am on node 10.10 and I still get the ExperimentalWarning.

@mhdawson
Copy link
Member

@ackvf can you open a new issue with the information on how to recreate? Please include node --version, platform and the command line you used along with what is necessary to recreate. There should be no warning.

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

7 participants