package.json:
"devDependencies": {
"tailwindcss": "^0.7.4"
},
"scripts": {
"tailwind:css": "tailwind build src/css/tailwind.src.css -c tailwind.js -o src/css/tailwind.css",
"start": "npm run tailwind:css && react-scripts start",
"build": "npm run tailwind:css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
error:
sh: 1: tailwind: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! client#0.1.0 tailwind:css: `tailwind build src/css/tailwind.src.css -c tailwind.js -o src/css/tailwind.css`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the client#0.1.0 tailwind:css script.
Even though (in my experience) some heroku deployments seem to somehow get away with tailwind in the devDependencies, moving it into your dependencies does fix this issue.
This can affect more than just tailwind, so you might need to move more than just tailwind across for your build to work.
Related
When I run 'npm install' to install the dependencies from a cloned repository I get the error below from the terminal. I use windows 10
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-scripts#4.0.0
npm ERR! Found: typescript#4.1.3
npm ERR! node_modules/typescript
npm ERR! dev typescript#"4.1.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript#"^3.2.1" from react-scripts#4.0.0
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"4.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: typescript#3.9.10
npm ERR! node_modules/typescript
npm ERR! peerOptional typescript#"^3.2.1" from react-scripts#4.0.0
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"4.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\USER-PC\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER-PC\AppData\Local\npm-cache\_logs\2022-10-04T10_18_32_
Even when I ran npm install --legacy-peer-deps I still get same error. Please what could possibly be wrong?
And here's the content in my package.json file:
}
]
"name": "info-site",
"version": "1.0.0",
"description": "",
"keywords": [],
"main": "src/index.js",
"dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0",
"react-scripts": "4.0.0"
},
"devDependencies": {
"#babel/runtime": "7.13.8",
"typescript": "4.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
The error is telling you that react-scripts#4.0.0 supports typescript#^3.2.1 (i.e. TypeScript >=3.2.1, <4) as a peer dependency.
Your dev dependencies have TypeScript 4 (not 3.2.x) in them, which is not supported by that version of react-scripts, hence the resolution error.
The current version of react-scripts is 5.0.1, so I'd recommend upgrading react-scripts to that version (simply by changing that "4.0.0" in your package.json to "5.0.1") and trying again, since that version declares support for TypeScript 4.
I,m trying to run 'npm run build' but always get error, 'npm run start' command is run correcly,but build command not run.:(
{
"name": "films",
"version": "1.0.0",
"description": "contain about films",
"default": "index.html",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html --dist-dir ./dist "
},
"author": "chathura priyashan",
"license": "ISC",
"devDependencies": {
"parcel": "^2.3.2"
},
"dependencies": {
"node-sass": "^7.0.1"
}
}
err--------------------------------------------------
npm ERR! code ELIFECYCLE
npm ERR! errno 3221225501
npm ERR! films#1.0.0 build: `parcel build index.html `
npm ERR! Exit status 3221225501
npm ERR!
npm ERR! Failed at the films#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\chathura\AppData\Roaming\npm-cache\_logs\2022-03-28T14_56_48_033Z-debug.log
PS G:\java script sites\Asynchronus\films> npm run build
I am building a react app from scratch. Usually, I am running the npm create-react-app and it generates everything for you. I am following this tutorial https://www.youtube.com/watch?v=deyxI-6C2u4&ab_channel=TraversyMedia and it has the GitHub repository in the description. The problem is - when i run "npm start" it should run this command
webpack-dev-server --mode development --open --hot
which is written here in the package.json
"scripts": {
"start": "webpack-dev-server --mode development --open --hot",
"build": "./node_modules/.bin/webpack --mode production"
},
The command works if I am running it manually, but with npm start, it gives the following error
PS D:\React&Webpack4 boilerplate> npm start
> react-webpack4-boilerplate#1.0.0 start D:\React&Webpack4 boilerplate
> webpack-dev-server --mode development --open --hot
'Webpack4' is not recognized as an internal or external command,
operable program, or batch file.
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'D:\...\webpack-dev-server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-webpack4-boilerplate#1.0.0 start: `webpack-dev-server --mode development --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-webpack4-boilerplate#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\***\AppData\Roaming\npm-cache\_logs\2020-09-30T18_11_15_755Z-debug.log
I run into the same issue above. You can try the following:
"scripts": {
"start": "webpack-dev-server --open --hot",
"build": "./node_modules/.bin/webpack --mode production"
},
install it globally and try to add webpack path to local variables.
I'm trying to creaet a global node CLI app, but It depends on Babel to run.
I've added this to my package.json
"bin": {
"kurly": "dist/index.js"
},
"scripts": {
"prepare": "npm run build",
"build": "babel src -d dist",
"start": "yarn build && node dist/index.js"
},
and I'm installing it from my git using
npm install -g alexanderprod/kurly
But when installing it I get the following error
npm ERR! path /usr/local/lib/node_modules/kurly/dist/index.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/kurly/dist/index.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
So it seems like npm didn't build it with babel before applying chmod.
And now I'm wonderging how to fix that, since I assume it makes no sense to upload dist/ to npm/git
I've been using node.js/npm to deploy my React website to GitHub Pages but an error keeps showing up and not sure how to approach it. I have been looking around for solutions but there doesn't seem to be anything for this particular scenario:
I run the npm run build command for the completed application and add the correct GitHub Pages scripts in my package.json file below -
{
"name": "portfolio",
"version": "0.1.0",
"homepage": "https://darstnfrd.github.io/portfolio",
"private": true,
"dependencies": {
"bootstrap": "^4.0.0",
"gulp-sass": "^3.1.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.1"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"gh-pages": "^1.1.0"
}
}
Afterwards, I run npm install --save-dev gh-pages. From here, when I run npm run deploy this error below keeps emerging -
> portfolio#0.1.0 deploy C:\Users\darren\Desktop\react2018\portfolio
> gh-pages -d build
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:686:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\darren\AppData\Roaming\npm-cache\_logs\2018-03-12T02_09_20_837Z-debug.log
My GitHub Pages repository is ready to go. Additional actions I've tried are npm rm -rf node_modules, npm cache clean and reinstalling bootstrap dependency.
What exactly is the error? If any more information is needed, please let me know. Thank you very much!