when i am running command npm run dev i got error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
in package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.0.0",
"cross-env": "^5.2.1",
"jquery": "^3.2",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.13",
"popper.js": "^1.12",
"resolve-url-loader": "2.3.1",
"sass": "^1.20.1",
"sass-loader": "7.*",
"vue-template-compiler": "^2.6.10"
}
}
i have coding in composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",`enter code here`
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.0",
"laravel/tinker": "^1.0",
"laravel/ui": "^1.0"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Not sure why you call the config inside webpack node modules. But you should not call webpack directly inside node_modules. Let try this step by step
npm i --save-dev webpack
npm i --save-dev webpack-dev-server
I suggest to move node_modules/laravel-mix/setup/webpack.config.js to at the root folder, same the level of package.json. Then you can call the webpack directly
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development webpack --progress --hide-modules",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development webpack-dev-server --inline --hot",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production webpack --no-progress --hide-modules"
},
If still got error. May the error come from your webpack.config. Could you please post the content of it here. Thanks
Related
I'm having an error running npm run watch with laravel 8 when running I get this error:
Previously I got this error "cross-env" is not recognized as an internal or external command and run these commands:
npm uninstall cross-env npm install cross-env --no-bin-links npm run watch
this would be more my package.json configuration
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"#tailwindcss/forms": "^0.2.1",
"alpinejs": "^2.8.2",
"autoprefixer": "^10.1.0",
"axios": "^0.19",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"postcss": "^8.2.1",
"postcss-import": "^12.0.1",
"resolve-url-loader": "^3.1.0",
"tailwindcss": "^2.0.2",
"vue-template-compiler": "^2.6.14"
},
"dependencies": {
"#tailwindcss/forms": "^0.3.3",
"cross-env": "^7.0.3",
"node-sass": "^6.0.1"
}
when executing npm run watch it does not compile and the following appears
ERROR Failed to compile with 2 errors 10:22:41
error in ./resources/css/app.css
Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: PostCSS plugin tailwindcss requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
at Processor.normalize (c:\laragon\www\projet1\node_modules\postcss-loader\node_modules\postcss\lib\processor.js:153:15)
at new Processor (c:\laragon\www\projet1\node_modules\postcss-loader\node_modules\postcss\lib\processor.js:56:25)
at postcss (c:\laragon\www\projet1\node_modules\postcss-loader\node_modules\postcss\lib\postcss.js:55:10)
at c:\laragon\www\projet1\node_modules\postcss-loader\src\index.js:140:12
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at c:\laragon\www\projet1\node_modules\webpack\lib\NormalModule.js:316:20
at c:\laragon\www\projet1\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at c:\laragon\www\projet1\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (c:\laragon\www\projet1\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at c:\laragon\www\projet1\node_modules\postcss-loader\src\index.js:208:9
at processTicksAndRejections (internal/process/task_queues.js:97:5)
I just clone my project from github, but when I run npm install, an error occurred.
This project runs perfectly on my pc. However, it can't even be initialized on my linux laptop. Any solutions?
Here is the error message,
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#testing-yarnlibrary%2freact - Not found
npm ERR! 404
npm ERR! 404 '#testing-yarnlibrary/react#^11.1.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/anthonyzhang/.npm/_logs/2021-08-13T17_45_59_614Z-debug.log
package.json,
{
"name": "qrcode-ordering",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.11.4",
"#testing-yarnlibrary/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"bootstrap": "^5.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#fortawesome/fontawesome-free": "^5.15.4",
"css-loader": "^6.2.0",
"style-loader": "^3.2.1"
}
}
You misspelled #testing-library/react in your package.json as #testing-yarnlibrary/react
https://yarnpkg.com/package/#testing-library/react
I am trying explore Tailwindcss and want to add it to a new Wordpress project. I am using Laravel Mix for compiling assets.
After setting up everything and running "npm run dev", i get the following error:
ERROR in ./assets/src/main.css Module build failed (from
./node_modules/css-loader/index.js): ModuleNotFoundError: Module not
found: Error: Can't resolve './node_modules/tailwindcss/base.css' in
...
My current settings are based on this article:
https://paulund.co.uk/using-tailwind-css-in-your-wordpress-theme
Here's code for my package.json
{
"name": "tailwind-wordpress",
"version": "1.0.0",
"description": "WP Theme with Tailwind CSS",
"dependencies": {
"cross-env": "^6.0.3",
"laravel-mix": "^5.0.0",
"postcss-import": "^12.0.1",
"tailwindcss": "^1.1.2"
},
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}
}
And this is contents of webpack.mix.js
const mix = require('laravel-mix');
mix.postCss('./assets/src/main.css', './assets/dist/main.css', [
require('tailwindcss'),
])
And main.css:
#import 'node_modules/tailwindcss/base.css';
#import 'node_modules/tailwindcss/components.css';
#import 'node_modules/tailwindcss/utilities.css';
Any ideas how to solve this issue? All help is highly appreciated.
if you're using webpack and all that jazz you should use
#import "tailwindcss/base";
#import "tailwindcss/components";
#import "tailwindcss/utilities";
Error after run npm run dev :
enter image description here
package.json config:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.19",
"cross-env": "^7.0",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"resolve-url-loader": "^3.1.0"
}
}
I have node version 14.13.1 and npm version 6.14.8
How resolving it's? Thanks!
Recently, when I've tried to run npm install in a phoenix app, I've gotten this error:
npm ERR! path /Users/sam/Projects/xxxx/xxxx/file:deps/phoenix/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open '/Users/sam/Projects/xxxx/xxxx/file:deps/phoenix/package.json'
npm ERR! package.json npm can't find a package.json file in your current directory.
However, when I look in deps/phoenix, there definitely a package.json file.
This is the main application's package.json:
{
"repository": {},
"license": "MIT",
"scripts": {
"deploy": "brunch build --production",
"watch": "brunch watch --stdin"
},
"dependencies": {
"phoenix": "file:deps/phoenix",
"phoenix_html": "file:deps/phoenix_html"
},
"devDependencies": {
"babel-brunch": "~6.0.0",
"brunch": "2.10.9",
"clean-css-brunch": "~2.0.0",
"css-brunch": "~2.0.0",
"sass-brunch": "2.10.4",
"elm-brunch": "^0.9.0",
"javascript-brunch": "~2.0.0",
"uglify-js-brunch": "~2.0.1"
}
}
and deps/phoenix/package.json:
{
"name": "phoenix",
"version": "1.2.1",
"description": "The official JavaScript client for the Phoenix web framework.",
"license": "MIT",
"main": "./priv/static/phoenix.js",
"repository": {
"type": "git",
"url": "git://github.com/phoenixframework/phoenix.git"
},
"author": "Chris McCord <chris#chrismccord.com> (http://www.phoenixframework.org)",
"devDependencies": {
"brunch": "~2.6.5",
"mocha": "~2.4.4",
"babel-brunch": "~6.0.0",
"uglify-js-brunch": "~2.0.1"
},
"files": ["README.md", "LICENSE.md", "package.json", "priv/static/phoenix.js"],
"scripts": {
"test": "./node_modules/.bin/mocha ./web/test/**/*.js --compilers js:babel-register"
}
}