Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional dependencies not met #628

Closed
aderaaij opened this issue Oct 11, 2016 · 10 comments · Fixed by #789
Closed

Optional dependencies not met #628

aderaaij opened this issue Oct 11, 2016 · 10 comments · Fixed by #789

Comments

@aderaaij
Copy link

Do you want to request a feature or report a bug?
A bug

What is the current behavior?
When running yarn optional dependencies of packages are not met.

If the current behavior is a bug, please provide the steps to reproduce.
Run a package with optionalDependencies declared
What is the expected behavior?
Since there is an explicit --ignore-optional flag, I expect optional dependencies to be met.

Please mention your node.js, yarn and operating system version.
node: 4.1.2
yarn: 0.15.1
osx: 10.12

@Jessidhia
Copy link

--ignore-optional is for not even attempting to install them. By default, they should be attempted to be installed, but not complain on failure.

@sebmck
Copy link
Contributor

sebmck commented Oct 11, 2016

Do you have any output that would imply that any of these failed to install or is it silent? If you put together a repro that I can run locally that reproduces this then I should definently be able to fix this!

@aderaaij
Copy link
Author

Woah, that's a fast response!

The package at hand is gulp-imagemin and it seems to have optional dependencies that are not truly optional. The packages are not installed in the node_modules folder and running the task gives an error. Could you give it a try with gulp-imagemin or should I make a quick example?

@rdmurphy
Copy link

I'm hitting the same issue via gulp-imagemin. It throws this error when I try to run my gulp project that uses that package:

Error: Cannot find module 'imagemin-gifsicle'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/path/to/project/node_modules/gulp-imagemin/index.js:8:26)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/path/to/project/gulp/images.js:5:18)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)

I'm not sure if this is a gulp-imagemin issue or imagemin itself.

@thasmo
Copy link

thasmo commented Oct 11, 2016

Same here. Looks like optional dependencies won't get installed.

node 6.7.0
yarn 0.15.1
windows 10 64-bit

@deepu105
Copy link

same here for gulp-imagemin

module.js:341                                                                                                 
    throw err;                                                                                                
    ^                                                                                                         

Error: Cannot find module 'imagemin-gifsicle'                                                                 
    at Function.Module._resolveFilename (module.js:339:15)                                                    
    at Function.Module._load (module.js:290:25)                                                               
    at Module.require (module.js:367:17)                                                                      
    at require (internal/module.js:16:19)                                                                     
    at Object.<anonymous> (D:\Projects\test\angular2test\node_modules\gulp-imagemin\index.js:8:26)            
    at Module._compile (module.js:413:34)                                                                     
    at Object.Module._extensions..js (module.js:422:10)                                                       
    at Module.load (module.js:357:32)                                                                         
    at Function.Module._load (module.js:314:12)                                                               
    at Module.require (module.js:367:17)                                                                      

@jing2si
Copy link

jing2si commented Oct 12, 2016

@deepu105 04d2a3d

@sendilkumarn
Copy link
Contributor

@deepu105 if the PR is accepted. It will close the issue

@jing2si 👍

@deepu105
Copy link

@sendilkumarn thats great 👍

@deepu105
Copy link

please note even running yarn add gulp-imagemin explicitly doenst work. There is a warning about fsevents failed, which is an optional dependency

PS D:\Projects\test\angular2test> yarn add gulp-imagemin
yarn add v0.15.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "rhino" appears to be invalid.
warning [email protected]: The engine "rhino" appears to be invalid.
warning [email protected]: The engine "rhino" appears to be invalid.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency
└─ [email protected]
Done in 400.80s.
PS D:\Projects\test\angular2test> gulp install
module.js:341
    throw err;
    ^

Error: Cannot find module 'imagemin-gifsicle'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (D:\Projects\test\angular2test\node_modules\gulp-imagemin\index.js:8:26)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)

Installing the optional dependency directly yarn add imagemin-gifsicle produces below error

yarn add v0.15.1
warning [email protected]: "dependencies" has dependency "gulp-imagemin" with range "^3.0.3" that collides with a dependency in "devDependencies" of the same name with version "3.0.3"
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "rhino" appears to be invalid.
warning [email protected]: The engine "rhino" appears to be invalid.
warning [email protected]: The engine "rhino" appears to be invalid.
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'D:\Projects\test\angular2test\node_modules\@types\angular\index.d.ts'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/add for documentation about this command.

But when i run the command yarn add imagemin-gifsicle again it installed successfully, so this might be a whole new issue as I encountered the same for imagemin-jpegtran and imagemin-optipng which are all optional dependency of gulp-imagemin I will open a new ticket for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants