I am trying to add tailwind css in my react app created with create react app. There is error in build:styles script. Error says like this postcss src/tailwind.css -o src/styles.css Error: true is not a PostCSS plugin. I followed different resources but I am stuck with same error. This is the one article im referring dev
Can you please check the below code? Hope it will work for you. You can try this way, it might be helpful for you.
"scripts": {
"start": "react-scripts start",
"build": "npm run build:styles && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"build:styles": "postcss src/tailwind.css -o src/styles.css",
}
Related
I am planning to deploy the frontend with Next.js and the backend with springboot.
Even though I built next.js, next.js still print out the following error.
Could not find a production build in the
'C:\Users\tojaeung\Desktop\blog\frontend.next' directory. Try
building your app with 'next build' before starting the production
server. https://nextjs.org/docs/messages/production-start-no-build-id
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
Since i help you to solve this ploblem, i wrote the folling log when i build app of next.js.
Loaded env from
C:\Users\tojaeung\Desktop\blog\frontend.env.production info -
Linting and checking validity of types ..error - ESLint: Failed to
load config "plugin:prettier/recommand" to extend from. Referenced
from: C:\Users\tojaeung\Desktop\blog\frontend.eslintrc.json info -
Linting and checking validity of types info - Disabled SWC as
replacement for Babel because of custom Babel configuration ".babelrc"
https://nextjs.org/docs/messages/swc-disabled info - Using
external babel configuration from
C:\Users\tojaeung\Desktop\blog\frontend.babelrc (node:6312)
[DEP_WEBPACK_MODULE_UPDATE_HASH] DeprecationWarning:
Module.updateHash: Use new ChunkGraph API (Use node --trace-deprecation ... to show where the warning was created) info - Creating an optimized production build info - Compiled successfully
As you can see, it's built without a problem.
What is the cause of this problem?
The following error is occured when run cmd "next build".
Add a build script in your package.json, so that you can run npm run build or yarn build. Just make sure next is installed as one of the dependencies.
"scripts": {
"dev": "next dev",
"start": "next start",
"build": "next build"
},
Alternatively, you may run npx next build.
React app deploys fine through local cli,
though on github actions it fails with error:
sh: 1: firebase: not found
Error: Process completed with exit code 127.
package.json:
"scripts": {
"start": "react-scripts start",
"build": "CI=false react-scripts build && firebase deploy -P riplir",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
What am I doing wrong here?
I would assume from this that you have the firebase executable on your desktop and not in the pipeline. Whilst the pipeline could be totally valid commands and configuration for firebase, it won't be able to do anything without the executable.
Try adding a pre-requisite command like:
npm init
npm install --save firebase
Or using an image that is guaranteed to have an up to date version of the firebase executable present.
See the Firebase package for more information.
I want to make es6 into my project so I used this tutorial this tutorial
and when i try to write 'webpack' in cmd I get the error
Done in 8.99s.
{ Error: Cannot find module 'webpack-cli'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at runCommand.then.result (C:\Users\adirz\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:62:14)
at process._tickCallback (internal/process/next_tick.js:109:7) code: 'MODULE_NOT_FOUND' }
package.json
{
"name": "functions",
"scripts": {
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "~5.12.0",
"firebase-functions": "^1.0.1"
},
"devDependencies": {
"ts-loader": "^4.2.0",
"typescript": "^2.5.3",
"webpack": "^4.5.0",
"webpack-cli": "^2.0.14",
"webpack-node-externals": "^1.7.2"
},
"private": true
}
my folder structure
Try using: npm i -g webpack-cli.
Here is the official issue on github: https://github.com/webpack/webpack-cli/issues/191
Link globally installed package to your project
npm link webpack-cli
This solved the problem for me
sudo chown -R $USER /usr/local/lib/node_modules
npm i -g webpack-cli
https://flaviocopes.com/npm-fix-missing-write-access-error/
The problem for me it was that I was not using 'sudo' permissions.
If you are using linux based system try typing sudo npm i -g webpack-cli
I had a similar error. For me the answer was to ensure that the whole path to my project is free of spaces, ampersands(&) or any other weird characters.
If you are using Yarn instead NPM to run Webpack globally, you can install webpack using the following commands:
yarn global add webpack
and or
yarn global add webpack-cli
Following the firebase function getting started guide and getting a seemingly simple error once trying to deploy with:
firebase deploy --only functions
i deploying functions
Running command: npm --prefix $RESOURCE_DIR run lint
npm ERR! path C:\Users\Beat\leginformant\$RESOURCE_DIR\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open
'C:\Users\Beat\leginformant\$RESOURCE_DIR\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
The package.json file does exist just as the tutorial shows in my project/functions/package.json.
Have tried changing or printing out the RESOURCE_DIR env with no success. Assuming it would be scoped inside of the NPM shell environment.
npm version: 5.6.0
node version: 8.9.0
This is a known problem with the Firebase CLI 3.17.0 through at least 3.17.3, but only on Windows. You can fix this on your machine by editing firebase.json at the root of your project and replacing $RESOURCE_DIR with %RESOURCE_DIR% in the npm commands you see there. The former is the unix syntax way to use an environment variable, whereas the latter is the Windows command shell syntax. Since you're using Windows, you need to use the Windows syntax.
The team is looking into ways to prevent having to make changes to the config files you use, as it's not really convenient for teams that works across platform to keep changing the same file back and forth.
EDIT: This issue should be fixed with projects created with CLI version 3.17.5.
When running
firebase init functions
I use this configuration
? What language would you like to use to write Cloud Functions? JavaScript
//TypeScript doesn't work
? Do you want to use ESLint to catch probable bugs and enforce style? Yes
//If you don't you will get a missing file lint
? File functions/package.json already exists. Overwrite? Yes
? Do you want to install dependencies with npm now? Yes
//Why not
Then if use windows
Replace $RESOURCE_DIR by %RESOURCE_DIR% in firebase.json
In windows, while Initializing the firebase Project in CLI using firebase init,In firebase.json file,Change the code to as per below{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint"
],
"source": "functions"
}
}
After this change, try firebase deploy --only functions command.
Change the following:
npm --prefix \"$RESOURCE_DIR\" run lint
to
npm --prefix \"%RESOURCE_DIR%\" run lint
in firebase.json file in main structure
{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint"
],
"source": "functions"
}
}
You can fix this by accessing your firebase.json file and delete this line containing RESOURCE_DIR.
Apart from the other suggestions, if you change the preflight/predeploy command from:
"npm --prefix \"$RESOURCE_DIR\" run lint", OR
"npm --prefix \"%RESOURCE_DIR%\" run lint"
to
"npm --prefix ./functions run lint"
the issue seems to get fixed. This also resolves it for both Windows and Linux.
To see more details, please see this answer (and further thread): https://github.com/firebase/firebase-tools/issues/610#issuecomment-360147507
You have to change firebase.json file as shown in here
"npm --prefix functions run lint"
"npm --prefix functions run build"
As an extra doing npm --prefix %RESOURCE_DIR% run lint like #Deji James said, made me some progress but still didn't work.
As a suggestion I found this
https://github.com/firebase/firebase-tools/issues/610
and #merlinnot says here
Hey guys, you all probably have sth in your predeploy in firebase.json, don't you? Just delete what you have there for now if it's not that important.
worked for me.
PS. before deciding to delete, I have done all reinstall things, uninstall things. Only this is worked.
For ubuntu you need to change firebase.json to following, notice $ before RESOURCE_DIR
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
}
for Windows 10 you need to change firebase.jsonn to following, notice % after and before RESOURCE_DIR
{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint",
"npm --prefix \"%RESOURCE_DIR%\" run build"
]
}
}
(for Windows no idea if it work in ios or not)Just delete everything under "Predeploy":
it should look like
"predeploy": [ ],
and this work for me hope it will solve your problem also
i find this solution here