Code Monkey home page Code Monkey logo

Comments (14)

mattiasw avatar mattiasw commented on July 28, 2024 1

I'm really sorry for this, I was too quick to push a new feature. I have now reverted that broken release so if you try again now with version 3.5.0 the install should work fine. I will make adjustments to make sure it doesn't happen again. Big thanks for reporting this!

from exifreader.

Satsh24 avatar Satsh24 commented on July 28, 2024 1

Thank you so much for the quick turn around ❀️. Will try to install it again now.

from exifreader.

mattiasw avatar mattiasw commented on July 28, 2024 1

The CI tests should catch this but apparently they don't. :-( I have a solution for the error but haven't managed yet to adjust the CI build to fail when this happens. Will continue looking tomorrow!

from exifreader.

mattiasw avatar mattiasw commented on July 28, 2024 1

This should be fixed in 3.12.4. Fun fact: PowerShell GitHub Actions do not fail the build by default.

from exifreader.

OliverJAsh avatar OliverJAsh commented on July 28, 2024 1

3.12.5 fixes the issue! Great work. Thanks so much.

from exifreader.

OliverJAsh avatar OliverJAsh commented on July 28, 2024

I'm also running into this on the latest version.

Reduced test case:

  1. Clone https://github.com/OliverJAsh/exifreader-webpack-error
  2. Run yarn

Note: it works the second time you run yarn.

$ yarn
yarn install v1.19.1
warning package.json: No license field
info No lockfile found.
warning No license field
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ”¨  Building fresh packages...
error /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader: Command failed.
Exit code: 1
Command: node bin/build.js --only-with-config
Arguments:
Directory: /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader
Output:
Installing ExifReader custom build dependencies...

> [email protected] install /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node
+ [email protected]
+ [email protected]
+ [email protected]
+ @babel/[email protected]
+ @babel/[email protected]
+ [email protected]
+ [email protected]
+ @babel/[email protected]
added 546 packages from 268 contributors and audited 546 packages in 16.176s
found 0 vulnerabilities

Done.
/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/cli.js:93
				throw err;
				^

Error: Cannot find module 'terser-webpack-plugin'
Require stack:
- /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/webpack.config.js
- /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/utils/convert-argv.js
- /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/cli.js
- /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:713:15)
    at Function.Module._load (internal/modules/cjs/loader.js:618:27)
    at Module.require (internal/modules/cjs/loader.js:771:19)
    at require (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/webpack.config.js:8:22)
    at Module._compile (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Module.require (internal/modules/cjs/loader.js:771:19)
    at require (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at WEBPACK_OPTIONS (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13)
    at requireConfig (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6)
    at /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
    at Array.forEach (<anonymous>)
    at module.exports (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)
    at /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/cli.js:71:45
    at Object.parse (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/yargs/yargs.js:576:18)
    at /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/cli.js:49:8
    at Object.<anonymous> (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Module.require (internal/modules/cjs/loader.js:771:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack/bin/webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/webpack.config.js',
    '/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/utils/convert-argv.js',
    '/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack-cli/bin/cli.js',
    '/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/node_modules/webpack/bin/webpack.js'
  ]
}
child_process.js:660
    throw err;
    ^

Error: Command failed: webpack
    at checkExecSyncError (child_process.js:621:11)
    at execSync (child_process.js:657:15)
    at Object.<anonymous> (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/bin/build.js:12:5)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:931:10)
    at internal/main/run_main_module.js:17:11 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 60503,
  stdout: null,
  stderr: null
}
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

from exifreader.

OliverJAsh avatar OliverJAsh commented on July 28, 2024

After upgrading I can't reproduce this problem locally anymore (on Mac), but unfortunately I am still running into problems in my Travis build. Do you have any ideas why that might be?

The error here is slightly different:

$ yarn install --production=false
yarn install v1.10.1
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "newtype-ts@^0.3.2".
warning " > @pmmmwh/[email protected]" has unmet peer dependency "sockjs-client@^1.4.0".
warning " > @pmmmwh/[email protected]" has unmet peer dependency "type-fest@^0.13.1".
warning " > @pmmmwh/[email protected]" has unmet peer dependency "[email protected]".
warning " > @pmmmwh/[email protected]" has unmet peer dependency "[email protected] || 1.x".
warning " > [email protected]" has incorrect peer dependency "[email protected] - 6.x".
warning "pm2 > @pm2/agent > [email protected]" has unmet peer dependency "bufferutil@^4.0.1".
warning "pm2 > @pm2/agent > [email protected]" has unmet peer dependency "utf-8-validate@^5.0.2".
warning "pm2 > @pm2/js-api > [email protected]" has unmet peer dependency "bufferutil@^4.0.1".
warning "pm2 > @pm2/js-api > [email protected]" has unmet peer dependency "utf-8-validate@^5.0.2".
warning " > [email protected]" has incorrect peer dependency "mapbox-gl@^1.6.0".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.6.2".
warning " > [email protected]" has incorrect peer dependency "typescript@^3.4.0".
warning " > [email protected]" has incorrect peer dependency "cypress@^3.0.0".
warning " > [email protected]" has incorrect peer dependency "eslint@^3 || ^4 || ^5 || ^6".
warning " > [email protected]" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0".
warning " > [email protected]" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning " > [email protected]" has unmet peer dependency "iltorb@^2.0.0".
warning " > [email protected]" has unmet peer dependency "node-zopfli-es@^1.0.3".
[5/5] Building fresh packages...
error /home/travis/build/unsplash/unsplash-web/node_modules/exifreader: Command failed.
Exit code: 1
Command: node bin/build.js --only-with-config
Arguments: 
Directory: /home/travis/build/unsplash/unsplash-web/node_modules/exifreader
Output:
Installing ExifReader custom build dependencies...
audited 569 packages in 21.2s
found 0 vulnerabilities
Done.
/bin/sh: 1: webpack: not found
child_process.js:660
    throw err;
    ^
Error: Command failed: webpack
    at checkExecSyncError (child_process.js:621:11)
    at execSync (child_process.js:657:15)
    at Object.<anonymous> (/home/travis/build/unsplash/unsplash-web/node_modules/exifreader/bin/build.js:12:5)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function

from exifreader.

mattiasw avatar mattiasw commented on July 28, 2024

It can't find webpack which is weird... Or at least it wasn't meant to be like that. My first guess was that your server does not have webpack globally installed while mine does. But on my local laptop I actually don't have webpack installed globally and this still works there. So I'm not sure what's happening here... I will try some things.

from exifreader.

mattiasw avatar mattiasw commented on July 28, 2024

If possible, could you try this branch out? It uses npx webpack instead of just webpack which seems much more logical. I'm not sure how it could have worked at all without that. :-) It shouldn't have if webpack was not globally installed.
#133

from exifreader.

OliverJAsh avatar OliverJAsh commented on July 28, 2024

I'm not sure how it could have worked at all without that. :-) It shouldn't have if webpack was not globally installed.

It looks like we run npm install webpack if isDependenciesInstalled is falseβ€”so we shouldn't need to use npx?

        if (!isDependenciesInstalled()) {
            console.log('Installing ExifReader custom build dependencies...'); // eslint-disable-line no-console
            execSync('npm install --loglevel=error --no-optional --no-package-lock --no-save @babel/core @babel/preset-env @babel/register babel-loader cross-env string-replace-loader webpack webpack-cli terser-webpack-plugin', {stdio: 'inherit'});
            console.log('Done.'); // eslint-disable-line no-console
        }

If we do switch to using npx, how will these other dependencies get installed?

(Side note: we should probably lock the version of webpack so it doesn't break all of a sudden if there's a breaking change in webpack.)

After playing around a bit more, I managed to reproduce it locally on my Mac by running yarn install --production inside of the reduced test case repo I shared earlier. (Note this repo now includes the upgraded version of this package.)

$ trash node_modules yarn.lock && yarn cache clean
yarn cache v1.19.1
warning package.json: No license field
success Cleared cache.
✨  Done in 0.06s.

$ yarn install --production
yarn install v1.19.1
warning package.json: No license field
info No lockfile found.
warning No license field
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ”¨  Building fresh packages...
error /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader: Command failed.
Exit code: 1
Command: node bin/build.js --only-with-config
Arguments:
Directory: /Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader
Output:
Installing ExifReader custom build dependencies...
audited 572 packages in 10.477s
found 0 vulnerabilities

Done.
/bin/sh: webpack: command not found
child_process.js:660
    throw err;
    ^

Error: Command failed: webpack
    at checkExecSyncError (child_process.js:621:11)
    at execSync (child_process.js:657:15)
    at Object.<anonymous> (/Users/oliverash/Development/exifreader-webpack-error/node_modules/exifreader/bin/build.js:12:5)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:931:10)
    at internal/main/run_main_module.js:17:11 {
  status: 127,
  signal: null,
  output: [ null, null, null ],
  pid: 29025,
  stdout: null,
  stderr: null
}
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I think webpack is installed but it doesn't exist on the PATH. We can fix this by making the following change:

-    execSync('webpack', {stdio: 'inherit'});
+    execSync('./node_modules/.bin/webpack', {stdio: 'inherit'});

I tested this by making the change and then running:

cd node_modules/exifreader
node bin/build.js --only-with-config

from exifreader.

mattiasw avatar mattiasw commented on July 28, 2024

To be honest I was not completely aware about how much npx actually does. Let's skip that. I could not get execSync('./node_modules/.bin/webpack', {stdio: 'inherit'}); to work either though. But I have a new idea. Apparently the --production is passed down. That is why the dependencies are not getting installed, they are dev dependencies. This seems to solve that (the important addition being --production=false). I think the only effect will be that dev dependencies are not ignored during the custom build.

https://github.com/mattiasw/ExifReader/pull/133/files#diff-983cdf348a40e3b9474612a84d8f52af0be59dae4f97e2e068dbd46d243de054R19

I also locked the versions, that was a good point, thanks!

from exifreader.

OliverJAsh avatar OliverJAsh commented on July 28, 2024

I could not get execSync('./node_modules/.bin/webpack', {stdio: 'inherit'}); to work either though.

Oh weird. You were able to reproduce the problem using my steps above, but then after you made the change the problem still occurred? I'm really surprised.

To be clear, this is how I tested the fix, in the reduced test case repo I shared:

  1. First, reproduce the problem by running rm -rf node_modules && yarn install --production
  2. Open node_modules/exifreader/bin/build.js and make the change
  3. Run cd node_modules/exifreader && node bin/build.js --only-with-config to re-run the postinstall script

But I have a new idea. Apparently the --production is passed down. That is why the dependencies are not getting installed, they are dev dependencies. This seems to solve that (the important addition being --production=false). I think the only effect will be that dev dependencies are not ignored during the custom build.

Hmm, I don't think this is going to fix the issue. The issue isn't that the dependencies are not being installedβ€”they are being installed as I can see they are there in node_modules/exifreader/node_modules. (They are not installed when I run yarn but rather when the postinstall script manually invokes npm install.) Rather, the issue is that webpack does not exist on the PATHβ€”we have to invoke it explicitly from ./node_modules/.bin.

from exifreader.

mattiasw avatar mattiasw commented on July 28, 2024

This took a while, but I think I understand now. At least part of it. But first, yes, I could reproduce the error locally from your repo. Not sure why I had a problem with the ./node_modules/.bin/webpack though, should've worked.

Anyway, I know why just a single webpack actually works and why it didn't for you. When running the script using npm ... the node_modules/.bin directory is added to the PATH. And that does not happen if you just run e.g. node bin/build.js. One thing I still can't figure out though is that I really do have to add the --production=false for it to work, and I agree, it doesn't really make sense in my limited knowledge.

A sidenote which also highlights a difference in testing. The way I test this is by running npm pack in my ExifReader repo folder. This creates a .tgz file which will work as a real npm package. Then in the package.json in your repo I put "exifreader": "/path/to/ExifReader/exifreader-3.12.4.tgz". That way it can be tested in full without actually publishing the package. Without the fix I always get that webpack is missing, with the fix it always goes through.

Still don't trust it fully though but I have published a new version (3.12.5) (can't get any worse) so please try it out once more. Since I realized the PATH was updated when running with npm ... I think this could work.

from exifreader.

mattiasw avatar mattiasw commented on July 28, 2024

Great news! Big thanks for helping out with this. I would neither have realized nor managed otherwise.

from exifreader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.