Playwright component error: Cannot find module 'vite/package.json' - components

I'm receiving the following error when trying to run playwright component tests in github CI. Running it locally it works fine. Would greatly appreciate the help
Error: Cannot find module 'vite/package.json'
Require stack:
/home/runner/work/project/project/node_modules/#playwright/test/lib/plugins/vitePlugin.js
/home/runner/work/project/project/node_modules/#playwright/experimental-ct-react/index.js
/home/runner/work/project/project/playwright-ct.config.ts
/home/runner/work/project/project/node_modules/#playwright/test/lib/loader.js
/home/runner/work/project/project/node_modules/#playwright/test/lib/runner.js
/home/runner/work/project/project/node_modules/#playwright/test/lib/cli.js
/home/runner/work/project/project/node_modules/playwright-core/lib/cli/cli.js
/home/runner/work/project/project/node_modules/playwright-core/cli.js
/home/runner/work/project/project/node_modules/#playwright/test/cli.js

Related

App deployed on Vercel "Cannot find module '#redis/client'" but it works locally

My app is an API that serves data from a Redis db. It works all fine locally, but once deployed on Vercel I get this error:
undefined ERROR Cannot find module '#redis/client'
Require stack:
- /var/task/node_modules/redis/dist/index.js
- /var/task/helpers/redis.js
- /var/task/models/model.js
- /var/task/routes/routes.js
- /var/task/api.project.js
- /var/task/___now_launcher.js
- /var/runtime/index.mjs
Did you forget to add it to "dependencies" in `package.json`?
Cannot find module '#redis/client'
The app is successfully deployed but it actually fails to run.
I just use the package "redis": "^4.0.2" locally, but i tried to install the specific package #redis/client": "^1.4.2 as well to see if it'd fix the problem in Vercel. But the problem persists.
How to fix this?

pushing to Heroku error: Module not found: Error: Can't resolve './components/Header/' in '/tmp/build_0b321d16/client/src'

I am currently trying to push my app to heroku and it's giving me the following error in console:
for some reason my header component won't resolve, this is how I imported it in react:
import Header from "./components/Header/";
I checked the path and it should work, I'm not sure why it is giving me an error. This site was built with the mern stack.

Jest fails to parse TSX in preact

I'm trying to run tests with Jest and enzyme in a Preact app with TypeScript.
I get a Jest encountered an unexpected token error :
FAIL src/app/app.test.tsx
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse,
e.g. it's not plain JavaScript.
...
Details:
src/app/app.test.tsx:10
const wrapper = enzyme_1.mount(<app_1.default optOutUrl="none"/>);
^
SyntaxError: Unexpected token <
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1059:14)
After seen TypeScript example in this repository, I Changing jsx option to react in tsconifg.json. But It not helpful for my project environment:
Cannot find module 'react' from 'styled.js'
However, Jest was able to find:
'./styled.js'
'./styled.js.flow'
'./styled.js.map'
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:276:11)
at Object.<anonymous> (node_modules/linaria/src/react/styled.js:3:15)
In the above error, it says that react parsing failed in the styled component related file. (I’m use styled components from linaria/react with custom Preact typing.) this issue not appear in development and production environment.
I also tried using babel-jest with below config.
“transform”: {
“^.+\\.t(s|x)$”: “babel-jest”
}
FAIL src/app/app.test.tsx
● Test suite failed to run
src/app/app.tsx: Cannot find module 'react'

Why cant heroku find my node modules when deploying?

When I deploy I get the error Cannot find module '../../models/User' but my
solution works fine locally. here is a pic of my console console log of errors and a link to the repo https://github.com/No-MyNameIs/trashalbums
I understand similar questions have been presented and I worked through those solutions before presented and I tried working through those below with no luck. Any help would be appreciated.
Heroku deploy Error: Cannot find module - compilation
Heroku Cannot find module
console log of errors
The version of Node.js that will be used to run your application on Heroku, should also be defined in engines section of your package.json file.
For example:
"engines": {
"node": "11.0.0",
},
docs: https://devcenter.heroku.com/articles/deploying-nodejs#specify-the-version-of-node

NuxtJS build breaks with UglifyJS and node-rsa. How do I resolve this?

I'm using the library node-rsa (https://www.npmjs.com/package/node-rsa) in a NuxtJS project. When building for production using the command nuxt build (which includes minification of JS and CSS by default), the build process breaks near the end with the following message:
ERROR in 0.nuxt.bundle.7c6932a7a42bdaaa7fa4.js from UglifyJs
Unexpected token: name (pem) [./~/node-rsa/src/formats/pkcs1.js:55,0][0.nuxt.bundle.7c6932a7a42bdaaa7fa4.js:42640,20]
Error: Webpack build exited with errors
at /home/ubuntu/front-end/node_modules/nuxt/dist/nuxt.js:904:44
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:267:15
at Compiler.emitRecords (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:362:37)
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:260:12
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:355:11
at next (/home/ubuntu/front-end/node_modules/tapable/lib/Tapable.js:154:11)
at Compiler.compiler.plugin (/home/ubuntu/front-end/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/home/ubuntu/front-end/node_modules/tapable/lib/Tapable.js:158:13)
at Compiler.afterEmit (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:352:8)
at Compiler.<anonymous> (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:347:14)
at /home/ubuntu/front-end/node_modules/async/dist/async.js:460:16
at iteratorCallback (/home/ubuntu/front-end/node_modules/async/dist/async.js:1034:13)
at /home/ubuntu/front-end/node_modules/async/dist/async.js:944:16
at /home/ubuntu/front-end/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:117:15)
I was able to temporarily mitigate the issue by disabling uglifyJS (solution found at https://github.com/nuxt/nuxt.js/issues/250) but that does not seem like a long term solution. What is the correct way to resolve this?
Potentially related issue: Webpack breaks when i include node-rsa library
The problem is that I was trying to use a node library (not uglify-safe) on the browser without webpacking it. I switched to using pure JS for my crypto needs and everything went fine.

Resources