npm install error in laravel 5.6 with fresh installation - node.js

I get the following error while running npm install on a fresh laravel 5.6 installation on windows 7 32 bit, npm version 5.7.1, node v9.5.0
npm ERR! path
D:\xampp\htdocs\2018\thehealthsearch\node_modules\node-sass\node_modules\har-validator\bin\har-validator
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod 'D:\xampp\htdocs\2018\thehealthsearch\node_modules\node-sass\no
de_modules\har-validator\bin\har-validator'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2018-03-14T05_58_42_171Z-debug.log
How to resolve this?
EDIT :
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 --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.0.0",
"popper.js": "^1.12",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.4",
"vue": "^2.5.16"
},
"dependencies": {
"har-validator": "^5.1.0",
"yarn": "^0.16.1"
}
}

You need to try this commands line by line:
npm cache clean
npm install -g gulp bower
npm install
bower install
gulp & gulp watch
This commands do:
for cleaning a cache of npm
installs gulp bower globally
installs npm
installs bower
for mixing all js and css and watch on all changes of css & js
Hope this will helps you and fixed your issue!

Related

Can't run npm install on new docker container

I've been stuck for a couple of days trying to get a docker container to run for npm on my laravel install. No matter what I try npm install always ends in the error below or something similar.
npm ERR! code EINTEGRITY
npm ERR! sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== integrity checksum failed when using sha512: wanted sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== but got sha512-XfyffAC+g/7ZA4f5L0XtDj2yuUZIpXolG23LrI8FAM9661vPwCRW50r9xTi16O7+IhE+OGMFJrOLnBvSbByphQ==.
I have tried npm cache verify, npm cache clear --force, removing package-lock.json, and reinstalling npm within the container.
My dockerfile is
FROM node:latest
WORKDIR /var/www
COPY package*.json ./
RUN npm cache verify
RUN node -v (node -v returns 14.2.0)
RUN npm -v (npm -v returns 6.14.4)
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "npm", "start" ]
and in my docker-compose
npm:
image: node:latest
container_name: npm
working_dir: /var/www
build:
context: ./
dockerfile: node.dockerfile
My package.json is the default from the laravel install (below)
{
"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",
"bootstrap": "^4.0.0",
"cross-env": "^7.0",
"jquery": "^3.2",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.13",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "^8.0.0",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
}
}
Any help at this point would be very much appreciated. Thank you.

Gatsby’s Environmental Variables "env.cmd not found"

Trying to run env.cmd with Gatsby but I'm getting sh: env-cmd not found. I do have installed the package. I have tried deleting .node-modules and running npm install but I'm still getting the same error.
gatsby-config.js:
{
...
"scripts": {
"build": "gatsby build",
"develop": "env-cmd --file .env.development --fallback gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"dependencies": {
"gatsby": "^2.18.12",
"gatsby-plugin-sass": "^2.1.26",
"node-sass": "^4.13.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"typescript": "^3.7.4"
},
"devDependencies": {
"env-cmd": "^8.0.2",
"prettier": "^1.19.1"
},
...
}
Terminal:
npm run develop
> gatsby-starter-hello-world#0.1.0 develop /Users/renatognunes/Documents/Studies 1:4/Gatsby/gatsby-site
> env-cmd --file .env.development --fallback gatsby develop
sh: env-cmd: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! gatsby-starter-hello-world#0.1.0 develop: `env-cmd --file .env.development --fallback gatsby develop`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the gatsby-starter-hello-world#0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
UPDATE
For anyone else running into the same issue, here is the solution I found that worked for me: https://stackoverflow.com/a/56367980/10225590
Changing my npm version to v16.3.1 from v14.18.3 fixed this for me

Trying to run "npm run dev" but it doesn't work

I'm on windows working on a new laravel project everything worked good so far but when i tried to run this command i had those errors :
C:\Users***\Documents\files\Laravel\RSWebSite > npm run dev
'CALL "C:\Program Files\nodejs\node.exe" "C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js" prefix -g' n'est pas
reconnu en tant que commande interne ou externe, un programme
exécutable ou un fichier de commandes.
> # dev C:\Users\***\Documents\files\Laravel\RSWebSite
> npm run development
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn C:\windows\system32\cmd.exe;
npm ERR! file C:\windows\system32\cmd.exe;
npm ERR! path C:\windows\system32\cmd.exe;
npm ERR! errno ENOENT
npm ERR! # dev: `npm run development`
npm ERR! spawn C:\windows\system32\cmd.exe; ENOENT
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\***\AppData\Roaming\npm-cache\_logs\2019-10-22T14_06_36_677Z-debug.log
This 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": "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.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": "^2.5.17",
"vue-template-compiler": "^2.6.10"
}
}
you need to delete package-lock.json or yarn.lock then clear npm caches, you can do this by implementing those commands
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
I encountered this most of the time when I pull a new project.
try doing this.
npm install
npm audit fix
then run it again sometimes the cause of this is missing packages .

yarn run dev - cross-env: Permission denied

My dev environment is Vagrant ScotchBox, Node 6.6.2, Npm 3.9.5.
I'm trying to compile the assets of my Laravel project using Mix.
yarn install
yarn run dev
With yarn run dev i get sh: 1: cross-env: Permission denied
sh: 1: cross-env: Permission denied
npm ERR! Linux 3.13.0-55-generic
npm ERR! argv "/home/vagrant/.nvm/versions/node/v6.2.2/bin/node" "/home/vagrant/.nvm/versions/node/v6.2.2/bin/npm" "run" "development"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
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 126
npm ERR!
npm ERR! Failed at the # development script '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! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! 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! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/public/your-weedelivero/npm-debug.log
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c npm run development
Directory: /var/www/public/your-weedelivero
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/var/www/public/your-weedelivero/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Please, someone can help me?
Regards
/////////////////
maybe my package.json is wrong
{
"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 --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.17",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.1.3",
"jquery": "^3.2",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.5.7"
}
}
I Had this problem in my ubuntu 16.04.
for me, it fixes the problem
first, get into your directory in terminal and enter below command.
npm rebuild
I just remove the Nodejs and install the latest version of Nodejs and now I don't have this problem anymore
Laravel Mix "sh: 1: cross-env: not found error"

Angular 2 QuickStart on Linux not working

I'm setting up Angular 2 Quick Start Tutorial from scratch on a virtualbox Linux machine build. I've followed all the instructions as part of the 5 minute quick start but when I get to the "npm start" I get this error:
/media/sf_testdev/angular-quickstart$ npm start
> angular-quickstart#1.0.0 start /media/sf_testdev/angular-quickstart
> tsc && concurrently "npm run tsc:w" "npm run lite"
sh: 1: concurrently: not found
npm ERR! Linux 4.4.0-42-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v6.7.0
npm ERR! npm v3.10.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! angular-quickstart#1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the angular-quickstart#1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc && concurrently "npm run tsc:w" "npm run lite"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /media/sf_testdev/angular-quickstart/npm-debug.log
Here is my current package.json file
{
"name": "angular-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"#angular/common": "2.0.0-rc.6",
"#angular/compiler": "2.0.0-rc.6",
"#angular/compiler-cli": "0.6.0",
"#angular/core": "2.0.0-rc.6",
"#angular/forms": "2.0.0-rc.6",
"#angular/http": "2.0.0-rc.6",
"#angular/platform-browser": "2.0.0-rc.6",
"#angular/platform-browser-dynamic": "2.0.0-rc.6",
"#angular/router": "3.0.0-rc.2",
"#angular/upgrade": "2.0.0-rc.6",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.11",
"systemjs": "0.19.27",
"zone.js": "^0.6.17",
"angular2-in-memory-web-api": "0.0.18",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.2.0",
"lite-server": "^2.2.2",
"typescript": "^1.8.10",
"typings":"^1.3.2"
}
}
Nothing I have tried online seems to work to fix. thanks for the help in advance!
It seems the error is when it tries to run the command concurrently
sh: 1: concurrently: not found
you have to run npm install first to install the dependencies and then you will have concurrently, and everything should work fine.
That's because tsc command finds errors in the code. If you execute only tsc in terminal can you see the errors and fix it.
If you only run the app remove tsc && in start line, finally this is as:
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\",
to
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
With it works.
Sorry I did dont see all the log, concurrently: not found is because concurrently module isn't install, deleting node_modules folder and executing:
npm install
Or installing specifically concurrently with:
npm install -g concurrently

Resources