I am trying to made a full stack project using react and django from the tuto of bad traversy of react and django here react it is a django app i flow the tuto and when it coming to excute the flowing command npm run dev and dev it is "dev":" webpack --mode development ./leadmanager/frontend/src/index.js --output-path ./leadmanager/frontend/static/main.js",
i have some errors they are
(venv) youssef#youssef-HP-EliteBook-840-G3:~/Desktop/fullstack$ npm run dev
> fullstack#1.0.0 dev /home/youssef/Desktop/fullstack
> webpack --mode development ./leadmanager/frontend/src/index.js --output-path ./leadmanager/frontend/static/
[webpack-cli] Running multiple commands at the same time is not possible
[webpack-cli Found commands: 'bundle', './leadmanager/frontend/src/index.js'
webpack-cli Run 'webpack --help' to see available commands and options
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! fullstack#1.0.0 dev: webpack --mode development ./leadmanager/frontend/src/index.js --output-path ./leadmanager/frontend/static/
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the fullstack#1.0.0 dev 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! /home/youssef/.npm/_logs/2020-12-29T13_19_24_663Z-debug.log
From docs try to use it as following:
webpack --mode development --entry ./leadmanager/frontend/src/index.js --output-path ./leadmanager/frontend/static/main.js
Notice the --entry
And also you might want to change --output-path part to look like: --output-path ./leadmanager/frontend/static/frontend/
Not certain if it's a bug or if there's an updated format to the scripts, but rolling back to webpack-cli verson 4.2.0 works.
npm i -D webpack-cli#4.2.0
As PaulESPN mentioned, it looks like it’s a bug in the latest cli (4.3.0) The workaround it’s to explicitly list the command first, I.e. webpack serve where you replace serve with the command you’re trying to use.
Related
I am trying to deploy a React site in Azure App Service. i get error and logs shows errors like below. Its a huge log so i pasted a part of it. when i run "npm run build" it works and generates a "dist" folder. but this error is when i try to publish to azure using App Azure Service extention of VSCode.
Any suggestions whats going on here.?
modules 0 active npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! medefis#1.0.0 build: cross-env NODE_OPTIONS='--max-old-space-size=8192' NODE_ENV=production VIZ=true webpack --mode production --config webpack.config.prod.js --color -p --progress npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the medefis#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! /home/.npm/_logs/2020-12-23T00_47_33_640Z-debug.log ../deps/libexpat/lib/xmlparse.c:6:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]\n #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"\n ^~~~~~~~~~~~~~~~~~~~~~~~\nngrok - error unpacking binary Error: Could not find the End of Central Directory Record\n at DecompressZip.findEndOfDirectory (/tmp/8d8a6d70a2473e5/node_modules/decompress-zip/lib/decompress-zip.js:176:15)\n at _fulfilled (/tmp/8d8a6d70a2473e5/node_modules/q/q.js:854:54)\n at /tmp/8d8a6d70a2473e5/node_modules/q/q.js:883:30\n at Promise.promise.promiseDispatch (/tmp/8d8a6d70a2473e5/node_modules/q/q.js:816:13)\n at /tmp/8d8a6d70a2473e5/node_modules/q/q.js:624:44\n at runSingle (/tmp/8d8a6d70a2473e5/node_modules/q/q.js:137:13)\n at flush (/tmp/8d8a6d70a2473e5/node_modules/q/q.js:125:13)\n at processTicksAndRejections (internal/process/task_queues.js:79:11)\nngrok - install failed, retrying\n ⚠ Command failed: /tmp/8d8a6d70a2473e5/node_modules/cwebp-bin/vendor/cwebp -version\n/tmp/8d8a6d70a2473e5/node_modules/cwebp-bin/vendor/cwebp: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory\n\n\n
Do the scripts below locally:
npm install
npm run build
npm start
Deploy to Azure Web App (Check the stack Configuration):
There should be one log like this shows compressing the Modules:
It should work:
I tried to deploy a react app to GitHub pages...
Commands on package.json:
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
and received this error:
The "file" argument must be of type string. Received type undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
It was supposed to deploy.
I've resolved mine. Newer version 2.1 has some issue. Revert back to 2.0.1.
Reinstall Github pages with a specific version:
npm uninstall gh-pages
npm i gh-pages#2.0.1
npm run deploy // as usual
Hope that helped. :)
I'm deploy react app to git hub pages and receive error. File sizes after gzip:
68.67 KB build\static\js\2.c2c334ae.chunk.js
2.98 KB build\static\js\main.8a72b1a2.chunk.js
774 B build\static\js\runtime~main.8f8a00a4.js
The project was built assuming it is hosted at /sort-customers-list/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
To publish it at https://sejob.github.io/sort-customers-list,
run: npm run deploy
Find out more about deployment here:
sort-customers-list#0.1.0 deploy
C:\Users\SeJo\Documents\Code\DEV_HW\sort-customers-list
gh-pages -d build
The "file" argument must be of type string. Received type undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sort-customers-list#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sort-customers-list#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\SeJo\AppData\Roaming\npm-cache\_logs\2019-08-01T12_09_52_445Z-debug.log
The problem occurs in the new version of GitHub pages. Just use this command to install the previous version of GitHub pages:
npm install gh-pages#2.0.1
Hope it will help!
I also had this same problem on a fresh install of create-react-app. I have no idea what the problem was, but I did the following:
Downgrade gh-pages from 2.1.0 to 2.0.1
Instead of running npm run deploy, manually run npm run build then gh-pages -d build from the commandline.
At first, I'd get the same error in the commandline, even after checking that the version was downgraded to 2.0.1, but for some reason it worked after manually creating the gh-pages branch and pushing some files into it. As of now, npm run deploy throws the error but at least gh-pages -d build from the console works.
INSTALL/REINSTALL GIT
Update NPM
Reopen EDITOR
this solved my problem
use version 2.0.1
npm i gh-pages#2.0.1
In package.json devDependencies I have webpack-dev-server installed:
"webpack-dev-server": "3.2.1"
but when I run the start script, which looks as follows:
"start": "webpack-dev-server --inline --config demo/webpack.config.js --port 9000 --mode development"
I get this error:
sh: 1: webpack-dev-server: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! your-app#2.0.5 start: `webpack-dev-server --inline --config demo/webpack.config.js --port 9000 --mode development`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the your-app#2.0.5 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
What is the issue here?
Notice that every script you want access in cli, script should be install in your system as globally.
you can install globally every script you want with npm. that way add -g in your command when you want install package.
In your case, you should run this command:
npm install webpack-dev-server -g
after that you can access webpack-dev-server in your command. like your code webpack-dev-server added to start script in your package.json file.
After that, you can run npm install webpack-dev-server --save-dev command to add this package in your node_modules.
Now, you have access webpack-dev-server in your cli. As you write in your start script in your package.json.
My app by default, did a "production" install, which didn't install devDepencies.
I did:
export NODE_ENV=development
before executing npm install and it installed dev dependecies, so now it works.
i've just started out with react on codepen, and I really enjoy it! I decided to install it on my MacBook Air. I installed create-react-app using npm, and everything looked good. I then started a project, and everything went smoothly. When I ran npm start, I got an error:
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! react-app#0.1.0 start: 'react-scripts start'
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the react-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I've come to the conclusion that npm can't find react-scripts. I have done almost everything I have come up with: I have updated npm; I have reinstalled the modules; I have started a new project, but I still get the same error. I've checked, react-scripts is in my node_modules file. The only thing I haven't done is install react-scripts globally, but the creator of create-react-app has said that that is a very bad idea. What should i do?
Just solved the problem:
In package.json, I changed "start": react-scripts start", to "start": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js start". This solved the problem.
Try running npm install before running npm start, if that doesn't work check out this article on the same issue - sh: react-scripts: command not found after running npm start
Adding the entire path also worked for me:
"start": "node_modules/react-scripts/bin/react-scripts.js start"
instead of just:
"start": "react-scripts start".
I wish I knew why this behavior changed in my pc.
Coincidence or not, I updated my xcode today.
delete package-lock.json:
sudo rm package-lock.json
delete node_modules:
sudo rm -rf node_modules
optionally upgrade npm:
sudo npm install -g npm
and install project again
npm i
run project:
npm start
worked for me in the situation like you described