node -e
执行一段代码
eslint --ext vue
指定检查什么后缀的文件
我有一个Node.js项目,需要Node版本12或更高版本.是否可以在packages.json文件中指定此方法,以便安装程序自动检查并通知用户是否需要升级?
engines指定使用的nodejs版本,结合enginStrict:true,提示
Update
engineStrict is now deprecated, so this will only give a warning. It's now down to the user to run npm config set engine-strict true if they want this.
Update 2
As ben pointed out below, creating a .npmrc file at the root of your project (the same level as your package.json file) with the text engine-strict=true will force an error during installation if the Node version is not compatible.