Opened 9 years ago
Closed 6 years ago
#35105 closed task (blessed) (fixed)
Specifiy minimum node and npm version in package.json
Reported by: | jorbin | Owned by: | |
---|---|---|---|
Milestone: | 5.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Currently, package.json doesn't specify the engine property in package.json. Some of the dependencies though have minimum versions of node. This can lead to notices when a developer does an npm install. Specifying the minimum will make it easier for developers to know that the node and npm versions they should have installed are supported.
Attachments (6)
Change History (61)
#2
@
9 years ago
- Keywords has-patch added
@jorbin I've added { "engines" : { "node" : ">=0.12" } }
in the 35105.diff patch.
This ticket was mentioned in Slack in #core by jorbin. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
9 years ago
#7
@
9 years ago
- Milestone 4.5 deleted
This requires some coordination with the .org infrastructure team to make sure the build server is updated. Going to punt until I get a chance to do that as.
#9
@
8 years ago
- Minimum NodeJS version is set as
4.2.1
which was the first LTS version of the 4.x branch released per the LTS announcement here - The latest NodeJS 4.x.x LTS version is installed using NVM for Travis CI (bbPress Travis CI job example)
#10
follow-up:
↓ 11
@
8 years ago
NPM Roadmap https://github.com/npm/npm/wiki/Roadmap#tactical-roadmap
npm is currently supporting two release series. npm@3 is the current stable release series, and is included with Node.js 5. npm@2 is the legacy / long-term support release series, and will be supported for the Node.js 0.10, 0.12 and 4 LTS releases.
#11
in reply to:
↑ 10
@
8 years ago
Replying to netweb:
NPM Roadmap https://github.com/npm/npm/wiki/Roadmap#tactical-roadmap
npm is currently supporting two release series. npm@3 is the current stable release series, and is included with Node.js 5. npm@2 is the legacy / long-term support release series, and will be supported for the Node.js 0.10, 0.12 and 4 LTS releases.
Currently we overwrite the default Travis NPM installed version of NPM with npm install -g npm
in our .travis.yml
here, this installs the latest version which is the NPM v3 branch, this has been the case for quite some time, so we can either lock down v2 of NPM or continue to use v3. I think sticking to the v2 LTS branch might be the best option, less chance of it coming back to haunt us.
#12
@
8 years ago
We are also installing the latest Grunt-CLI via npm install -g grunt-cli
,
At the time of writing this is currently version 1.1.0
, the version 1.x
branch was only released yesterday (22nd March 2016), this is the first release in over 2 years.
The Grunt-CLI 1.x branch nows installs grunt-cli
as part of grunt
as documented here
As part of this ticket we should also determine the Grunt version we use, as such removing npm install -g grunt-cli
from .travis.yml
here at the same time.
#13
@
8 years ago
GruntJS 1.0.0 was released today http://gruntjs.com/blog/2016-04-04-grunt-1.0.0-released
#14
@
8 years ago
- Keywords needs-refresh added
Related: There is some NPM and NodeJS version checks added in #37116 hence the patch here will need a refresh once that ticked is resolved
#15
@
8 years ago
- Keywords needs-refresh removed
See https://core.trac.wordpress.org/ticket/37116#comment:8 for further details on the related issue and resolution.
- 35105.3.diff includes only the /trunk branch, it is identical to #37116's 37116-nodejs-4x-lts.diff though only /trunk.
- The patch contains NPM & NodeJS version checks before and after installing the new NodeJS version, makes things a little easier to debug knowing before and after NPM & NodeJS versions
This ticket was mentioned in Slack in #core by netweb. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by netweb. View the logs.
8 years ago
#20
@
8 years ago
To explain [39478], on the build server we have specific versions of node available -- currently 6.9.1 and 0.10.48. Pulling this out into a separate environment will be much easier to maintain long term, but in the meantime this is marginally better. I think we could probably make it so we don't need to bump patch releases in package.json, at least.
#21
@
8 years ago
- Keywords commit added
- Milestone changed from Future Release to 4.8
Lets get the Travis CI branch jobs no longer erroring or failing.
Adding commit
for committing stranger-node-things.diff for branches back to 3.7 please, and thank you.
This ticket was mentioned in Slack in #core by netweb. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by netweb. View the logs.
8 years ago
#29
in reply to:
↑ 28
;
follow-up:
↓ 30
@
8 years ago
The idea is to change only the Travis CI config since the additional tests and the package.json changes (which may break the build server) shouldn't be the cause of the failures.
Replying to ocean90:
In 40262:
This one is still failing, see https://travis-ci.org/ocean90/develop.wordpress/jobs/209556548.
Removing the shrinkwrap file will let the build pass: https://github.com/ocean90/develop.wordpress/commit/0803f7d91fd345971b3ec38c7c92c708b2bce7c0
#30
in reply to:
↑ 29
;
follow-up:
↓ 31
@
8 years ago
Replying to ocean90:
This one is still failing, see https://travis-ci.org/ocean90/develop.wordpress/jobs/209556548.
Removing the shrinkwrap file will let the build pass: https://github.com/ocean90/develop.wordpress/commit/0803f7d91fd345971b3ec38c7c92c708b2bce7c0
For the 4.5 and earlier branches I had to drop the version of NodeJS to the 4.x branch to satisfy the dependencies version requirements in the legacy package.json
files, see stranger-node-things.diff
#31
in reply to:
↑ 30
@
8 years ago
Replying to netweb:
For the 4.5 and earlier branches I had to drop the version of NodeJS to the 4.x branch to satisfy the dependencies version requirements in the legacy
package.json
files
Thanks, didn't notice that the patch uses different node versions. 😴
#36
follow-up:
↓ 37
@
8 years ago
@netweb Looks like Node 4.7.2 doesn't work for the 4.2 branch: https://travis-ci.org/aaronjorbin/develop.wordpress/jobs/210162438. Neither does 4.5.0 or 6.9.1. But 0.12.18 works.
Looking at https://travis-ci.org/aaronjorbin/develop.wordpress/branches, all the failed builds seem to be unrelated to the node version so I think we can stick with the node version which Travis is currently using.
#37
in reply to:
↑ 36
@
8 years ago
Replying to ocean90:
@netweb Looks like Node 4.7.2 doesn't work for the 4.2 branch: https://travis-ci.org/aaronjorbin/develop.wordpress/jobs/210162438. Neither does 4.5.0 or 6.9.1. But 0.12.18 works.
Cool, let's go with 0.12.x then
Replying to ocean90:
Looking at https://travis-ci.org/aaronjorbin/develop.wordpress/branches, all the failed builds seem to be unrelated to the node version so I think we can stick with the node version which Travis is currently using.
Up until these recent commits being merged we weren't able to determine if the builds were passing or failing as the jobs were reporting errrored
by Travis before PHPUnit or the JS Grunt tasks could be run, everything would error before any testing would commence.
The NodeJS versions I chose were an attempt to mimic the timeline of core's releases to the timeline of the NodeJS releases aiming for some glimmer of hope of compatibility with the branches package.json
files /shrug
I'm travelling for the remainder of today, I can take a look at updating a patch and testing tomorrow if no one beats me to it
#38
@
8 years ago
To get the right node version we have to check which grunt-sass
version is installed and what its node-sass
dependency is. For example 4.2 has "grunt-sass": "~0.18.0"
and the "node-sass": "^2.0.1"
dependency. Based on this version we can check https://github.com/sass/node-sass-binaries/tree/v2.0.1 for the latest native binding. In this case it's node 0.12.
#39
@
8 years ago
@nacin would be able to speak with complete certainty, but I'm fairly certain the build server was only updated to use 4.7.2 for 4.7+ . We should lock in the old version of node on the older installs so they match the build server. We have in the past avoided updating packages (which is why we have the shrinkwrap file) so that we didn't update CSS/JS in the old versions unintentionally.
#43
@
8 years ago
4.1 is now the latest branch which is green on Travis CI. All the other branches won't get green until someone is going to fix all the test failures. Most of the tests seem to be invalid though, see #30284.
#44
@
7 years ago
- Milestone changed from 4.8 to Future Release
- Owner ocean90 deleted
- Status changed from accepted to assigned
Related: #40463
#48
@
7 years ago
- Keywords commit added; needs-refresh removed
Refreshed patch for /trunk
in 35105.4.diff
Will follow up with applicable branch patches next week
This ticket was mentioned in Slack in #core by netweb. View the logs.
7 years ago
#51
@
7 years ago
Node 8.9.3 is now in use for Trunk.
As expected, changing the node version has caused CSS minification to change, see https://build.trac.wordpress.org/changeset/42290
#52
@
7 years ago
Travis is still using Node 6.x
I ran a test on my own Travis to see if changing it works as expected, and ran into this:
$ grunt $WP_TRAVISCI Loading "sass.js" tasks...ERROR >> Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (57) >> For more information on which environments are supported please see: >> https://github.com/sass/node-sass/releases/tag/v3.13.1
https://travis-ci.org/dd32/wordpress-develop/jobs/329316882#L844
Node 8.x is supported as of node-sass v4.5.3
My notes from #30787 ( Shrinkwrap NPM dependencies):
I just hit upon the NodeJS LTS document: https://github.com/nodejs/LTS/blob/master/README.md which details the LTS plan and roadmap which clears things up a bit on whats whats in regard to the timelines of NodeJS versions
Grepping the
/node_modules
folder shows the vast majority of packages require NodeJS>=0.10
, and 4 require>=0.12
>=0.12
so that includesautoprefixer
,grunt-rtlcss
, andgrunt-postcss
.get-stdin
is a dependant in thegrunt-contrib-imagemin
tree and also requires NodeJS>=0.12
None required NodeJS v4.x or greater so we can use NodeJS
>=0.12
for now, and switch to v4.x LTS once that need arises.Complimentary to this ticket could be to add grunt-check-dependencies via check-dependencies:
It was added to BuddyPress in changeset:10399 and the Grunt task is run before any other Grunt tasks, if it fails your prompted with the advisory to run
npm install
, works quite well and takes some of the pain out of working out maintaining your npm workflow.