Tutorial deploy-a-strapi-and-react-blog-on-netlify results with many warnings in the build process

I just run @Mcastres’ article Deploy a Strapi and React Blog on Netlify - and am reporting a potential set of issues related to the subtask click here to deploy a new Strapi instance on Heroku where the Build task takes more than 5 minutes to complete and the log shows over 10 different warnings.

If this is a well known issue, disregard this - otherwise let me know if someone wants me to add the build log to this article.

can you provide a screenshot of the warnings? if it’s about missing dependencies those can be ignored, typically we have a core package that holds the depends and there is no need for us to declare them on every package that uses it, it would just be redundant and make it more difficult for us to keep them up to date with any security issues or just regular package updates.

Here is the complete log - pay attention to

warning url-loader@1.1.2: Invalid bin field for "url-loader".

as well as several unmet peer dependencies (these have the potential for run time app crashes).

If I was a potential strapi customer, interested in using it with Cloudinary, I would worry about seeing these errors. Fixing them all should not be too difficult.


-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       USE_YARN_CACHE=true
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false
       
-----> Installing binaries
       engines.node (package.json):  >=10.0.0
       engines.npm (package.json):   >=6.0.0
       engines.yarn (package.json):  unspecified (use default)
       
       Resolving node version >=10.0.0...
       Downloading and installing node 15.2.1...
       Bootstrapping npm >=6.0.0 (replacing 7.0.8)...
       npm >=6.0.0 installed
       Resolving yarn version 1.22.x...
       Downloading and installing yarn (1.22.10)
       Installed yarn 1.22.10
       
-----> Prebuild
       Running heroku-prebuild (yarn)
       yarn run v1.22.10
       $ node scripts/postgres-env.js
       Start running postgres-env
       .env file is generated
       Finish running postgres-env
       Done in 0.13s.
       
-----> Installing dependencies
       Installing node modules (yarn.lock)
       yarn install v1.22.10
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       warning url-loader@1.1.2: Invalid bin field for "url-loader".
       info fsevents@2.1.2: The platform "linux" is incompatible with this module.
       info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.11: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning "strapi-admin > bootstrap@4.4.1" has unmet peer dependency "jquery@1.9.1 - 3".
       warning "strapi-admin > bootstrap@4.4.1" has unmet peer dependency "popper.js@^1.16.0".
       warning " > strapi-connector-bookshelf@3.1.0" has incorrect peer dependency "knex@^0.20.0".
       warning "strapi-plugin-graphql > graphql-playground-middleware-koa@1.6.12" has unmet peer dependency "koa@^2".
       warning "strapi-plugin-graphql > graphql-type-long@0.1.1" has incorrect peer dependency "graphql@^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0".
       warning "strapi-plugin-users-permissions > grant-koa@5.1.1" has unmet peer dependency "koa@>=2.0.0".
       [4/4] Building fresh packages...
       Done in 151.03s.
       
-----> Build
       Detected both "build" and "heroku-postbuild" scripts
       Running heroku-postbuild (yarn)
       yarn run v1.22.10
       $ strapi build && node scripts/postinstall.js
       Building your admin UI with production configuration ...
       ℹ Compiling Webpack
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
       ✔ Webpack: Compiled successfully in 1.70m
       Done in 104.76s.
       
-----> Pruning devDependencies
       yarn install v1.22.10
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@2.1.2: The platform "linux" is incompatible with this module.
       info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.11: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning "strapi-admin > bootstrap@4.4.1" has unmet peer dependency "jquery@1.9.1 - 3".
       warning "strapi-admin > bootstrap@4.4.1" has unmet peer dependency "popper.js@^1.16.0".
       warning " > strapi-connector-bookshelf@3.1.0" has incorrect peer dependency "knex@^0.20.0".
       warning "strapi-plugin-graphql > graphql-playground-middleware-koa@1.6.12" has unmet peer dependency "koa@^2".
       warning "strapi-plugin-graphql > graphql-type-long@0.1.1" has incorrect peer dependency "graphql@^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0".
       warning "strapi-plugin-users-permissions > grant-koa@5.1.1" has unmet peer dependency "koa@>=2.0.0".
       [4/4] Building fresh packages...
       warning Ignored scripts due to flag.
       Done in 13.61s.
       
-----> Caching build
       - yarn cache
       
-----> Build succeeded!
 !     Unmet dependencies don't fail yarn install but may cause runtime issues
       https://github.com/npm/npm/issues/7494
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 154M
-----> Launching...
       Released v6
       https://build-warnings.herokuapp.com/ deployed to Heroku

These are normal and should not cause issues for the reasons I stated above. Regarding the url-loader, I’m not sure of the reason why that is logged but based on a limited search around the interwebs, it’s not a critical issue. Appears to just be an issue with their bin generation, in which yarn/npm just build a new one anyway.

Sorry for the delay in commenting on your response - It seems that I am either deaf/blind or the forum tool does not tell me when someone added something to the discussion thread.

When I was still in charge of a serious development team I successfully imposed the rule that there are no “innocent / normal” error indications. A production app cannot show any error in the log, simply because a developer should not be asked to parse error logs and make the decision what entries do matter and what do not. I also still believe that this rule is long forgotten - it should be enforced today as much as before.

Most of them are log messages from upstream (beyond our control) and to swap libraries for simple warnings is not something we will do. Our core priority is making sure Strapi runs, runs well, and runs fast. Warnings from npm about missing dependencies (even when there aren’t, it just isn’t smart enough to find them) aren’t something we care about. I can’t say I’ve ever seen a Javascript project that doesn’t throw at least a handful of warnings :laughing:

For example fsevents, this package is for Macs, and has no purpose for Linux/Windows, thus we can’t remove this package and it will always throw warnings.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Even from that one above, you can see two different versions resolved 2.1.2 and 1.2.7 which is a core reason we try to avoid defining our own versions in packages which generate logs like:

npm WARN strapi-connector-bookshelf@3.3.4 requires a peer of knex@^0.20.0 but none is installed. You must install peer dependencies yourself.
npm WARN @buffetjs/utils@3.3.1 requires a peer of yup@^0.27.0 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.5.3 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.

We have our own method for defining knex => https://github.com/strapi/strapi/blob/583488fb4dd84d6708951a1d6e34ed4bdd191ae5/packages/strapi-connector-bookshelf/package.json#L31-L35

Yup is defined in the core strapi-admin package => https://github.com/strapi/strapi/blob/583488fb4dd84d6708951a1d6e34ed4bdd191ae5/packages/strapi-admin/package.json#L107

And jquery comes from another dependency.


We will always have warnings, and unless stuff breaks we don’t plan to address them.

That is a minimalistic approach - as I see no reason for avoiding to fix warnings like npm WARN strapi-connector-bookshelf@3.3.4 requires a peer of knex@^0.20.0 but none is installed. You must install peer dependencies yourself. There is a general perception that Strapi is buggy.

It complicates the project, this is fairly common in node based projects.