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

gulp build/test failing on Mac OS #8588

Closed
shahinrahbariasl opened this issue Jun 20, 2022 · 5 comments · Fixed by #8592
Closed

gulp build/test failing on Mac OS #8588

shahinrahbariasl opened this issue Jun 20, 2022 · 5 comments · Fixed by #8592
Assignees

Comments

@shahinrahbariasl
Copy link
Contributor

Type of issue

bug

Description

Have been running into issues with gulp build/test after rebasing on latest master branch:

shahinrahbariasl-MacBook-Pro:prebid.js shahin.rahbariasl$ gulp test
Error: Cannot find module './index.js'
Require stack:
- /Users/shahin.rahbariasl/Desktop/IX/prebid.js/gulpHelpers.js
- /Users/shahin.rahbariasl/Desktop/IX/prebid.js/webpack.conf.js
- /Users/shahin.rahbariasl/Desktop/IX/prebid.js/gulpfile.js
- /usr/local/lib/node_modules/gulp-cli/lib/shared/require-or-import.js
- /usr/local/lib/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- /usr/local/lib/node_modules/gulp-cli/index.js
- /usr/local/lib/node_modules/gulp-cli/bin/gulp.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
    at Function.resolve (internal/modules/cjs/helpers.js:21:19)
    at /Users/shahin.rahbariasl/Desktop/IX/prebid.js/gulpHelpers.js:94:53
    at Array.map (<anonymous>)
    at Object.getLibraryFiles (/Users/shahin.rahbariasl/Desktop/IX/prebid.js/gulpHelpers.js:94:33)
    at /Users/shahin.rahbariasl/Desktop/IX/prebid.js/webpack.conf.js:48:40
    at Array.forEach (<anonymous>)
    at /Users/shahin.rahbariasl/Desktop/IX/prebid.js/webpack.conf.js:40:42
    at Object.<anonymous> (/Users/shahin.rahbariasl/Desktop/IX/prebid.js/webpack.conf.js:61:5)
    at Module._compile (internal/modules/cjs/loader.js:759:30) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/shahin.rahbariasl/Desktop/IX/prebid.js/gulpHelpers.js',
    '/Users/shahin.rahbariasl/Desktop/IX/prebid.js/webpack.conf.js',
    '/Users/shahin.rahbariasl/Desktop/IX/prebid.js/gulpfile.js',
    '/usr/local/lib/node_modules/gulp-cli/lib/shared/require-or-import.js',
    '/usr/local/lib/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js',
    '/usr/local/lib/node_modules/gulp-cli/index.js',
    '/usr/local/lib/node_modules/gulp-cli/bin/gulp.js'
  ]
}

Looks like the error is coming from gulpHelpers. Not sure if there's a conflict with other index.js files or not but might be related to recent changes in #8527 ?

Steps to reproduce

On Mac OS:

  1. clone master branch
  2. run gulp build or gulp test3.

Workaround was to change index.js in line 111 to anything other than index.

Test page

Screen Shot 2022-06-20 at 7 21 22 PM
.

Screen Shot 2022-06-20 at 7 24 24 PM

Expected results

gulp build/test should work after npm install regardless of OS.

Actual results

gulp buld/test fails in Mac OS.

Platform details

  • Mac OS Monterey
  • Latest Prebid.js

Other information

@ChrisHuie ChrisHuie self-assigned this Jun 21, 2022
@ChrisHuie
Copy link
Collaborator

ChrisHuie commented Jun 21, 2022

@shahinrahbariasl Both seemed to work for me on Mac OS. What version of Node are you running? I know we had a similar issue with an older node version on packages being installed in the wrong place because of a similar naming conflict. I'm on v16.13

@shahinrahbariasl
Copy link
Contributor Author

shahinrahbariasl commented Jun 21, 2022

Hey @ChrisHuie , hmm interesting, I'm on v12.0.0. I can try upgrading but didn't have this issue till yesterday that I rebased. My guess is also that some naming conflict is happening.

@ChrisHuie
Copy link
Collaborator

ChrisHuie commented Jun 21, 2022

Hey @ChrisHuie , hmm interesting, I'm on v12.0.0. I can try upgrading but didn't have this issue till yesterday that I rebased. My guess is also that some naming conflict is happening.

Yeah. Let me dig into a bit more because the issue I was talking about I don't think it applies here. It had been a while since I looked at it (#7689)

@dgirardi
Copy link
Collaborator

@shahinrahbariasl could you try changing this line:

const files = library.files.map(file => require.resolve(file, {paths: ['./libraries/' + name + '/']}));

into:

const files = library.files.map((file) => path.resolve('./libraries/', name, file))

and see if it makes a difference?

@shahinrahbariasl
Copy link
Contributor Author

@dgirardi yup, that works!

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

Successfully merging a pull request may close this issue.

3 participants