quaertym / ember-cli-dependency-checker

Ember CLI addon for checking missing node and bower dependencies before running ember commands
MIT License
40 stars 38 forks source link

Incorrectly flagging optional dependencies #71

Open tamzinblake opened 7 years ago

tamzinblake commented 7 years ago

I'm not sure if this is new or related to #50, but...

My shrinkwrap file includes fsevents with "optional": true and so naturally npm doesn't install it on linux where it's not supported. But when running ember exam, I get:

Missing npm-shrinkwrap packages: 
Package: fsevents
Required by: pagerduty
  * Specified: 1.1.1
  * Installed: (not installed)
Run `rm -rf node_modules/ && npm install` to install missing dependencies.

The optional attribute was just added to npm shrinkwrap around the end of last year, so I wouldn't be surprised if it's not supported here yet, but it probably should be?

Temporary workaround might be just removing that bit from the npm shrinkwrap file for now.

d-schloss-mvg commented 7 years ago

Having the same issue here: Developing on a mac machine and CI running on a Linux: (Both nodejs v6.10.0, project is shrinkwraped)

npm install:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

and ember build:

Missing npm-shrinkwrap packages: 
Package: fsevents
Required by: remote-client
  * Specified: 1.1.2
  * Installed: (not installed)

Run `rm -rf node_modules/ && npm install` to install missing dependencies.

package.json:

    "broccoli-asset-rev": "^2.4.5",
    "ember-ajax": "^3.0.0",
    "ember-cli": "2.13.2",
    "ember-cli-app-version": "^3.0.0",
    "ember-cli-babel": "^6.0.0",
    "ember-cli-dependency-checker": "^1.3.0",
    "ember-cli-eslint": "^3.0.0",
    "ember-cli-htmlbars": "^1.1.1",
    "ember-cli-htmlbars-inline-precompile": "^0.4.0",
    "ember-cli-inject-live-reload": "^1.4.1",
    "ember-cli-qunit": "^4.0.0",
    "ember-cli-shims": "^1.1.0",
    "ember-cli-sri": "^2.1.0",
    "ember-cli-uglify": "^1.2.0",
    "ember-data": "~2.13.0",
    "ember-export-application-global": "^2.0.0",
    "ember-load-initializers": "^1.0.0",
    "ember-resolver": "^4.0.0",
    "ember-source": "~2.13.0",
    "loader.js": "^4.2.3"

and ember-cli-depenency-checker@1.4.0

tamzinblake commented 7 years ago

@d-schloss-mvg I upgraded to npm@5 and switched my shrinkwrap file to the new lockfile format, and this problem went away.

d-schloss-mvg commented 7 years ago

@thomblake Thanks for this hint!

SergeAstapov commented 7 years ago

Is there a way to handle fsevents which are marked optional in npm-shrinkwrap.json?

Have exactly the same issue as initially posted

peitschie commented 6 years ago

Adding a "me to" here as well. I've just migrated a project up to ember 3 & node 8.9.4, and we're now having to re-run npm install a second time to prevent the ember-cli-dependency-checker from complaining 😞 . This is on a Windows 10 environment.

c:\source> npm install
c:\source>npm run start

> opt-web@2.5.18-0 start C:\Work\Source\opt\emu
> ember serve

Missing npm-shrinkwrap packages:
Package: fsevents
Required by: opt-web
  * Specified: 1.1.3
  * Installed: (not installed)

Run `rm -rf node_modules/ && npm install` to install missing dependencies.

Stack Trace and Error Report: C:\Users\philipp\AppData\Local\Temp/error.dump.24d4374249beaba9d039ac3e7bec0cce.log
An error occurred in the constructor for ember-cli-dependency-checker at C:\Work\Source\opt\emu\node_modules\ember-cli-dependency-checker

c:\source>npm install
c:\source>npm run start
> opt-web@2.5.18-0 start C:\Work\Source\opt\emu
> ember serve

Build successful (39828ms) – Serving on http://localhost:4200/

UPDATE: I initially generated the shrinkwrap file on Windows, which excludes the fsevents initially. Then, the next npm install appears to add fsevents with optional: true back to the shrinkwrap file. If I then reset this back again, npm run start will work successfully.

peitschie commented 6 years ago

Just adding, a workaround for this is to:

  1. Add fsevents into the optionalDependencies section of `package.json
  2. Tell people to install using npm install --no-optional

It seems that just using npm install will not install fsevent (as it's not supported, so that is expected), but will still update the shrinkwrap file to list the optional dependency. If you instead to an explicit npm shrinkwrap afterwards, it will update the shrinkwrap file to remove fsevent again.