I'm trying to deploy my react app to github pages but facing some errors.
At first, when I tried to run npm run deploy in the terminal, it showed me this error:
new MiniCssExtractPlugin({
^
And MiniCssExtractPlugin is not a constructor
After that, I tried: npm i -D --save-exact mini-css-extract-plugin#2.4.5
This solved the problem but when I ran it again (npm run deploy), I get this error:
Creating an optimized production build...
Failed to compile.
The target environment doesn't support dynamic import() syntax so it's not possible to use
external type 'module' within a script
I don't know why it doesn't work, and also didn't find anything on the internet.
Thanks!
Related
Am new to Node and npm in general but I'm pretty sure I've gotten the hang at installing packages locally and whatnot. However, I've been trying to get eslint to work for awhile now and it always fails with the same error message despite trying multiple different test projects. It keeps saying that it cannot find a module 'array.prototype.flatmap' (pic provided below). Node is v18.13.0 and npm is v8.19.3 so I'm up to date. ESLint: ^8.31.0.
My steps are (after using 'npm init' to create a package.json file):
1. Locally install eslint to project directory using 'npm init #eslint/config' as shown on the site. (I also tried 'npm install -D eslint' AND THEN 'npm init #eslint/config' to configure after installing.
2. [Configs](https://i.stack.imgur.com/88f4V.png) I have tried with both standard and airbnb configs.
3. Have looked up vids that said to add a script to package.json: "scripts": { "lint": "eslint ./" } and running 'npm run lint'. This results in an error.
4. Have tried running npx eslint 'filename.js' .... same error.
This is the error I keep getting: Error msg:
Have tried repeatedly uninstalling packages, reinstalling, different directories and different projects. Even tried other stackoverflow responses to similar issues with different modules, but no avail. The module that always gives me a problem seems to be 'array.prototype.flatmap'.
Not sure where to from this point. Although I do not NEED eslint and might not use it all the time in the future, I don't want to give up trying simply because I'm having installation issues.
I had the same problem. I found this comment and bumped eslint-plugin-import lib.
// package.json
"eslint-plugin-import": "^2.27.2",
Error: File /vercel/path1/node_modules/simple-update-notifier/node_modules/semver/preload.js does not exist.
The build logs :
Tried removing the node modules and lock file and then publishing. Also tried switching between npm and yarn
please check if you have semver inside your package.json
I have been trying to create a new nextjs app for a project but I keep getting this error.
I have tried several techniques to create a new nextjs app but the same error continues.
I don't know if it's from my PC configuration or something because; recently, even npx create-react-app started giving the same error on my PC
Here's the error
Creating a new Next.js app in C:\Users\<user>\Desktop\websites\nextjs-starter.
Using yarn.
Installing dependencies:
- react
- react-dom
- next
Usage Error: The nearest package directory (C:\Users\<user>\Desktop\websites\nextjs-starter) doesn't seem to be part of the project declared in C:\Users\<user>.
- If C:\Users\<user> isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If C:\Users\<user> is intended to be a project, it might be that you forgot to list Desktop/websites/nextjs-starter in its workspace configuration.
- Finally, if C:\Users\<user> is fine and you intend Desktop/websites/nextjs-starter to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.
$ yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--mode #0] ...
Aborting installation.
yarn add --exact --cwd C:\Users\<user>\Desktop\websites\nextjs-starter react react-dom next has failed.
I just started using Laravel Mix which is using webpack. I'm having some issues resolving dependencies.
I tried to install l20n with npm install l20n, added it to my project by adding require('l20n'); and then I ran npm run dev only to be told the following:
ERROR Failed to compile with 1 errors
This dependency was not found:
* fs in ./~/l20n/dist/bundle/node/l20n.js
Alright, so I figured I had to install fs too, issuing npm install fs and then I ran npm run dev again, but I get the exact same message. What am I doing wrong?
Ok, I checked out the source and I think I know what the issue is. The lib you are using is supposed to run in a node environment.
So, in your webpack configuration add this:
target: 'node'
For more info on targets see this
I am wanting to use the react-native-db-models for local-db on my React Native iOS app.
I've npm installed react-native-db-models from here and have followed the instructions on the page of creating a db.js file that contains the example given on both Github page and NPM page. Then in the file that needs access to the DB, I've created vars for both DB and DBEvents, following the docs accordingly.
When running the project in Xcode it results in a Build Fail.
uncaught error Error: UnableToResolveError: Unable to resolve module
util from /Users/tmhn/Project/DoppioHealth/node_modules/react-native-db-models/node_modules/promise-es6/lib/utils.js:
Invalid directory /Users/node_modules/util
I have also npm installed the two dependencies listed on the npm page: es6-promises and eventemitter3, to no avail.
Note: DoppioHealth is the project name
Investigated the Github Issues and found this solved the issue