nicolo-ribaudo / chokidar-2

A wrapper around chokidar@2 to be able to specify both @2 and @3 as dependencies
1 stars 3 forks source link

Npm 7.12.1 #7

Closed natlibfi-jonollil closed 3 years ago

natlibfi-jonollil commented 3 years ago

New npm version 7.12.1 does not have command '--no-optional' anymore. (https://docs.npmjs.com/cli/v7/commands/npm-install) All packages what uses @babel/cli (https://www.npmjs.com/package/@babel/cli) will be installing this package on any type of environment.

Official docker image updated to use that npm version today (https://hub.docker.com/search?q=node&type=image) And now we cant update any of our projects because of this optional dependency

Log from our drone ci/cd pipe

npm install --no-optional
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

We already had to change all our projects to use 'npm install' instead of 'npm ci', because 'npm ci' does not have '--no-optional' parametter. I hope you can get this removed from @babel/cli in this week end.

nicolo-ribaudo commented 3 years ago

This package doesn't depend on fsevents.

nicolo-ribaudo commented 3 years ago

Btw, I tried running npm install --no-optional to install @babel/cli on linux using npm 7.21.1, and it didn't raise any error :thinking:

natlibfi-jonollil commented 3 years ago

Last time I think i had npm 6x and image had 7.x and that caused the problem and was solved when they rolled back npm version in node image. And now it is other way around i think.

My workstation has npm 7.23.0 and node v14.17.6 So my git update is making package-lock v2 (@babel/cli dependency). My drone image has npm 6.14.15 and node v14.17.6 (https://hub.docker.com/_/node :14)

On 'npm ci' or 'npm ci --no-optional' i get 'npm ERR! fsevents not accessible from chokidar'

On 'npm i', 'npm install' or 'npm i --no-optional' error has now bit more info:

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

So when developing on npm 7+ what generates lock file v2 and installing them on npm 6.x on Linux there it tries to install those optional dependencies.

I'm temporarily able to by pass this by updating npm version in drone commands before installation, but this is really bad way to solve this problem. Side note: they already published npm 8.1.0