I am busy learning Laravel 5.4, using Windows 7 and WAMP.
I have npm version: 4.1.2, and
node version: 7.6.0
After running npm install, I got these warnings:
deprecated node-uuid#1.4.7: use uuid module instead
prefer global marked#0.3.6 should be installed with -g
prefer global node-gyp#3.6.0 should be installed with -g
optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\chokidar\node_modules\fsevents);
notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.1: wanted {"os":"darwin", "arch":"any"} (current: {"os":"win32", "arch":"x64"})
Do I need to do anything with these warnings?
Then I ran npm run dev and got errors (log file)
I don't know anything about npm. Can someone please help me resolve these problems?
In the package.json file, change:
"dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
to
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
This seemed to help.
Related
I want to install Vue in laravel,
I run these commands and it all ok:
composer require laravel/ui:^2.4
php artisan ui vue
php artisan ui vue --auth
npm install
npm run dev
npm run dev is giving me this error and i don't know what to do
at Object.<anonymous> (/home/alikhani97/domains/imalikhani.me/public_html/node_modules/cross-
env/src/bin/cross-env.js:3:18)
npm ERR! Linux 3.10.0-1127.10.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "development"
npm ERR! node v6.17.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --
config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development script 'cross-env NODE_ENV=development
node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-
mix/setup/webpack.config.js'.
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous>
First check if cross-env module is installed. If not, run:
npm install cross-env
After that you need to go to the node_modules folder. Then find cross-env folder. Go inside and find cross-env.js.
In my case it was node_modules/cross-env/dist/bin/cross-env.js
You need to change path to cross-env.js in scripts section in your package.json file.
{
"private": true,
"scripts": {
"dev": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
........
}
If the above changes are already up to date then remove the directory
node_modules
and file
package-lock.json
update your node version to 8 and then
run command npm install and then npm run dev
this is my 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 --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",
"serve": "node --version",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node your-script.js"
},
"devDependencies": {
"axios": "^0.19",
"core-js": "^2.6.5",
"cross-env": "^7.0.2",
"laravel-mix": "^0.10.0np",
"lodash": "^4.17.19",
"resolve-url-loader": "^3.1.0",
"webpack": "^2.1.0-beta.22"
}
}
and the error is
$ npm run dev
# dev C:\xampp\htdocs\laspp
npm run development
# development C:\xampp\htdocs\laspp
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
95% emitting
ERROR Failed to compile with 3 errors 5:48:21 PM
These dependencies were not found:
* jquery in ./resources/assets/js/bootstrap.js
* bootstrap-sass in ./resources/assets/js/bootstrap.js
* vue in ./resources/assets/js/bootstrap.js
To install them, you can run: npm install --save jquery bootstrap-sass vue
Asset Size Chunks Chunk Names
/js/app.js 603 kB 0 [emitted] [big] /js/app
mix-manifest.json 32 bytes [emitted]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
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 2
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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Natty\AppData\Roaming\npm-cache\_logs\2020-10-13T00_48_22_038Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # 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! C:\Users\Natty\AppData\Roaming\npm-cache\_logs\2020-10-13T00_48_22_141Z-debug.log
finally, I tried this
rm -rf node-modules
rm packageson-lock.json
npm cache clean --force
npm install
but it does not work
Looking your error and your package.json, this error tell you this :
To install them, you can run: npm install --save jquery bootstrap-sass vue
Can you do this and restart your npm run development ?
I've been using Bulma as a CSS framework for a site I'm building using Laravel, and for some reason, none of the overrides I've been writing have actually been taking place. In fact, if I remove everything from my app.scss file (including the line to import Bulma), nothing changes. I tried following the docs given for node-sass, and when i try to execute the npm css-build command, I get the following error:
> # css-build /Users/userName/Sites/siteName
> node-sass --omit-source-map-url sass/app.scss css/app.css
An output directory must be specified when compiling a directory
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # css-build: `node-sass --omit-source-map-url sass/app.scss css/app.css`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # css-build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I know this is probably a terribly worded question, but I'd appreciate if anyone could point me in the right direction. I'm just genuinely lost.
app.scss:
#charset "utf-8";
#import url("https://fonts.googleapis.com/icon?family=Material+Icons");
// Variables
#import "_variables";
// Font Awesome
#import "font-awesome/scss/font-awesome";
// Bulma
#import "bulma/bulma";
// Bulma Vue Modules
#import "buefy/src/scss/buefy";
// Other SCSS Files
#import "overrides";
#import "helpers";
#import "manage";
#import "styles";
scripts portion of package.json:
"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",
"css-build": "node-sass --omit-source-map-url sass/app.scss css/app.css",
"css-watch": "npm run css-build -- --watch",
"start": "npm run css-watch"
},
Issue:
I have a Laravel 5.4 project with Vue.js and use Heroku for deployment. Everything has been running fine until today when I noticed the changes I made in the Vue component file were working fine locally, but not being reflected on Heroku.
In the past this happened when I forgot to run npm run build, but when I executed npm run build this time I got the following error:
npm ERR! Linux 4.10.0-42-generic
npm ERR! argv "/home/caseydemo/.nvm/versions/node/v6.11.4/bin/node" "/home/caseydemo/.nvm/versions/node/v6.11.4/bin/npm" "run" "build"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! missing script: build
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/caseydemo/Documents/gotcha/npm-debug.log
I wasn’t sure what to make of this so I tried removing my node modules and re-installing them with the following commands:
rm -rf node_modules
npm install
I got the following error after npm install ran:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
I am currently running Ubuntu 16.04 Xenial. Not really sure what to do next, any help is appreciated.
here is my package.json file:
{
"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": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"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 --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.16.2",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.0.1",
"jquery": "^3.1.1",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.1.10"
},
"dependencies": {
"hover.css": "^2.2.1"
}
}
You don't have a method build defined in your scripts, you're looking for prod or production:
npm run production
The error message you received tells you as much:
npm ERR! missing script: build
And if you look in the scripts definition in package.json, you'll see there is no build defined for sure.
I installed a fresh laravel 5.4 application. I followed the documentation on how to set up laravel mix. However, when I run npm run dev i get the following error:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm#3.8.6
3 info using node#v5.12.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle #~predev: #
6 silly lifecycle #~predev: no script for predev, continuing
7 info lifecycle #~dev: #
8 verbose lifecycle #~dev: unsafe-perm in lifecycle true
9 verbose lifecycle #~dev: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/vagrant/websites/ezskillz/node_modules/.bin:/usr/bin:/home/vagrant/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
10 verbose lifecycle #~dev: CWD: /home/vagrant/websites/ezskillz
11 silly lifecycle #~dev: Args: [ '-c',
11 silly lifecycle 'node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
12 silly lifecycle #~dev: Returned: code: 1 signal: null
13 info lifecycle #~dev: Failed to exec dev script
14 verbose stack Error: # dev: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at EventEmitter.emit (events.js:185:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at ChildProcess.emit (events.js:185:7)
14 verbose stack at maybeClose (internal/child_process.js:850:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid #
16 verbose cwd /home/vagrant/websites/ezskillz
17 error Linux 4.4.0-22-generic
18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev"
19 error node v5.12.0
20 error npm v3.8.6
21 error code ELIFECYCLE
22 error # dev: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 1
23 error Failed at the # dev script 'node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
23 error You can get information on how to open an issue for this project with:
23 error npm bugs
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
do you have any idea what's going on?
Thank you
I figured it out. Thanks to Andy Holmes. I had to update my nodejs in homestead running the following commands
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
and then I run the following command to rebuild node-sass
npm rebuild node-sass
Thanks
I removed the whole node_modules folder and tried installing packages with yarn instead of npm.
Delete the node_modules folder
Re-install packages using yarn i.e run yarn instead of npm install.
I hope this helps someone.
You have node and npm if you look at line 2 and 3 you can see
2 info using npm#3.8.6
3 info using node#v5.12.0
And at line 23 In the mid:
23 error If you do, this is most likely a problem with the package,
23 error not with npm itself.
i don't know why it is the case, whether it was a particular version that had a bug which has since been fixed, but to get my fresh laravel 5.4 install working at the time I had to change the paths in package.json from:
node_modules/cross-env/bin/cross-env.js
to
node_modules/cross-env/dist/bin/cross-env.js
note the addition of "dist"
Edit:
Actually notice on a newer fresh install the entire
node node_modules/cross-env/bin/cross-env.js
line is replaced simply with
cross-env
So for example:
"scripts": {
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"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",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},