cstefanache / angular2-img-cropper

Angular 2 Image Cropper
MIT License
364 stars 135 forks source link

[HELP or BUG] Trying to use image cropper with angular-cli webpack #59

Closed Mihai-B closed 7 years ago

Mihai-B commented 8 years ago

When I want to use the image cropper using the angular-cli latest version(now it switch to webpack), i get some errors when trying to run "npm i ng2-img-cropper --save"


305 silly lifecycle ng2-img-cropper@0.6.4~postinstall: Args: [ '-c', 'typings install' ]
306 info lifecycle ng2-img-cropper@0.6.4~postinstall: Failed to exec postinstall script
307 verbose unlock done using /home/mike/.npm/_locks/staging-15aa102294960ce4.lock for /home/mike/dev/repos/repo/myProj/node_modules/.staging
308 silly rollbackFailedOptional Starting
309 silly rollbackFailedOptional Finishing
310 silly runTopLevelLifecycles Finishing
311 silly install printInstalled
312 warn optional Skipping failed optional dependency /chokidar/fsevents:
313 warn notsup Not compatible with your operating system or architecture: fsevents@1.0.14
314 warn string-replace-loader@1.0.3 requires a peer of webpack@1.x.x || 2.x.x but none was installed.
315 verbose stack Error: ng2-img-cropper@0.6.4 postinstall: `typings install`
315 verbose stack spawn ENOENT
315 verbose stack     at ChildProcess.<anonymous> (/home/mike/.npm-packages/lib/node_modules/npm/lib/utils/spawn.js:33:16)
315 verbose stack     at emitTwo (events.js:106:13)
315 verbose stack     at ChildProcess.emit (events.js:191:7)
315 verbose stack     at maybeClose (internal/child_process.js:877:16)
315 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
316 verbose pkgid ng2-img-cropper@0.6.4
317 verbose cwd /home/mike/dev/repos/repo/myProj
318 error Linux 4.4.0-36-generic
319 error argv "/usr/bin/nodejs" "/home/mike/.npm-packages/bin/npm" "i" "ng2-img-cropper" "--save"
320 error node v6.5.0
321 error npm  v3.10.7
322 error file sh
323 error code ELIFECYCLE
324 error errno ENOENT
325 error syscall spawn
326 error ng2-img-cropper@0.6.4 postinstall: `typings install`
326 error spawn ENOENT
327 error Failed at the ng2-img-cropper@0.6.4 postinstall script 'typings install'.
327 error Make sure you have the latest version of node.js and npm installed.
327 error If you do, this is most likely a problem with the ng2-img-cropper package,
327 error not with npm itself.
327 error Tell the author that this fails on your system:
327 error     typings install
327 error You can get information on how to open an issue for this project with:
327 error     npm bugs ng2-img-cropper
327 error Or if that isn't available, you can get their info via:
327 error     npm owner ls ng2-img-cropper
327 error There is likely additional logging output above.
328 verbose exit [ 1, true ]

I am not sure if I am doing something wrong, or there is a problem with the cropper not getting along with webpack. It is working fine when using the angular-cli with broccoli

Juan671611 commented 7 years ago

To solve this please install typings

npm install typings -g

then try to install ng2-img-cropper again

jurienhamaker commented 7 years ago

Failed at the ng2-img-cropper@0.6.4 postinstall script 'typings install'.

As @Juan671611 stated, first run npm install typings (doesn't have to be global)