Heroku build fails: Can't find module - heroku

Heroku Deployment Build is failing. Error:
Cannot find module: 'react-redux'. Make sure this package is installed.
However:
Running npm run build works locally
I have react-redux in my package.json file (^7.2.0)
I am using express as my server and react on the client side. React and redux is installed in my client folder. All of the other modules installed and my build was working fine until I installed redux.
Any idea why this module can't be found?

ANSWER:
I had 'react-redux' in the 'devDependicies' section on my package.json file. Moving 'react-redux' to the 'dependencies' fixed the issue. :D

Related

Why isn't my clojure/cljs app deploying on Heroku?

I'm trying to deploy my app to heroku and I keep getting this error:
The required namespace "react" is not available, it was required by "reagent/core.cljs".
But I have
"react": "17.0.2-0",
"react-dom": "17.0.2-0",
"react-highlight.js": "1.0.7",
all in my package.json and I also put
[cljsjs/react "17.0.2-0"]
[cljsjs/react-dom "17.0.2-0"]
in my project.clj. I also did npm install react. I'm not sure what I'm doing wrong?
It compiles fine using shadow-cljs to my localhost, but it won't compile when I try to push to heroku. Any idea what I'm missing?
Editing to add some more details:
I made a bin/build file based on this blog post, even though I'm not using Fulcro: https://folcon.github.io/post/2020-04-12-Fulcro-on-Heroku/
I created a bin/build file that say this:
#!/usr/bin/env bash
npm install
npx shadow-cljs release main
clojure -A:depstar -m hf.depstar.uberjar fulcro.jar
I added this to my shadow-cljs.edn file:
;; v-- and this!
:release {:compiler-options {:optimizations :advanced}}}
And it also said to add something to my deps.edn file, but I don't have one so I didn't.
I also did the buildpack step to add the clojure and nodejs buildpacks, although I'm not using nodejs to my knowledge.
I had the same problem, it was very easy to fix.
You need to first specify buildpacks nodejs, and after it only clojure.
from here:
npm install react react-dom create-react-class

Is it possible to disable ESLint when running npm run build for a React app?

I have an app initiated using Create React App, so npm run build runs react-scripts build. I recently installed prettier and so added a .eslintrc.json file to the project root to load the prettier plugin. npm run build works as expected locally, but, when deploying the app to Heroku, npm run build tries to run ESLint and fails because the plugins are devDependencies rather than dependencies.
Failed to load plugin 'prettier' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-prettier'
From prior wrangling with a similar issue, I know that I can set NPM_CONFIG_PRODUCTION=false in Heroku so that it will install devDependencies, which actually does resolve the deployment issue. Nevertheless, I'm curious to learn if there's another solution that doesn't require setting NPM_CONFIG_PRODUCTION=false.
Is it possible to prevent npm run build in this scenario from running ESLint altogether or to prevent it from trying to access the plugins specified in .eslintrc.json? I acknowledge that adding .eslintrc.json to .gitignore is one solution, but I want the ESLint configuration in my repo.
you can run "npm run eject" to generate webpack configuration files, and then modify "webpack.config.js",delete the eslint configuration

npm production build fails for lodash function includes while dev build is fine

This is a laravel + vue project that builds successfully with npm run dev however fails to build successfully with npm run prod.
A few lodash method packages were removed and replaced with the latest lodash package itself.
The failure message for the prod build is Error: Cannot find module 'lodash.memoize'
Any thoughts or suggestions welcomed.

Node-sass error in AWS Lambda using RollupJS

I'm using serverless to create a Lambda (Node 10x).
The Lambda uses Rollup to create JS and CSS assets. But it is failing at the Rollup stage.
It runs locally using Node 10.0.0 and serverless-offline but once it gets to production, I get this error
2019-08-29T14:32:35.254Z ERROR error: { Error: Missing binding /var/task/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x
Found bindings for the following environments:
- OS X 64-bit with Node.js 10.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at error (/var/task/node_modules/rollup/dist/rollup.js:224:15)
at /var/task/node_modules/rollup/dist/rollup.js:17213:17
code: 'PLUGIN_ERROR',
plugin: 'postcss',
id: '/var/task/src/css/app.scss' }
I can run npm rebuild node-sass locally and it does something to my node_modules and makes it bigger, too big in fact to deploy to AWS!
So before I go and rip things out of the app to try and get it to compile at a smaller size, is there anything else I can do regarding this node-sass environment issue?
Thanks
Solved it!
In node_modules/node-sass/vendor/ there was only a darwin-x64-64/binding.node folder/file.
From this github page I downloaded linux-x64-64__binding.node
renamed it to binding.node and created a linux-x64-64 folder and put it in there: node_modules/node-sass/vendor/linux-x64-64/binding.node
Then redeployed the lambda and all is well. I just need to remember to do that if/when I do a yarn update or similar.

How do I install vuetify directly from github?

When I try with
npm install vuetifyjs/vuetify#v1.5.2
I get "Cannot find package".
UPDATE:
There is a packages folder under which there is a vuetify directory.
I tried npm installing that folder. Everything appeared to go well until I started the dev server.
Now in the console log I see:
[Vuetify] Multiple instances of Vue detected
Seems to be related to https://github.com/vuetifyjs/vuetify/issues/4068 but I cannot tell what the solution is at this point.
I had the same issue to use my own version of Vuetify, waiting for my pull request being accepted.
Here what I did:
I build the vuetify project with my fix.
yarn
yarn build
Then I took the content of 'packages/vuetify' and put it in a new git repository. I remove the .gitignore to be able to commit built files (/es5, /lib, /lib-temp, /dist)
Finally I add this git repository to my project to replace my vuetify version:
npm install git+https://gitlab.com/GITLABUSERNAME/REPOSITORYNAME.git
Looking at the package.json file, the package doesn't have a name property, which it would need to have for you to be able to install it from GitHub.
So the short answer is that you can't install vuetify directly from GitHub via npm.
However, you can install it directly from npm:
npm install vuetify#1.5.2
You can't install vuetify directly from GitHub but you can edit code in 1 component node_modules/vuetify/lib/components/VSlider/VSlider.js Then, you install patch-package and execute path package vuetify Delete node modules and execute yarn to create new node modules Last, yarn serve, you see your code is work
https://www.npmjs.com/package/patch-package

Resources