"NPM install" command line cannot run in LARAVEL project directory - laravel

I want to work with webpack and Laravel
I'm trying to install Mix in my Laravel project.
So i have installed node and npm succesfully.
When i run node -v and npm -v in vscode it show me the version number so i think the install is ok.
But when i go in the Laravel project directory and try to run "npm -v" or "npm install" i have a message like "npm: The term 'npm' is not recognized as the name of cmdlet, function, file
script or executable program"...
Did i do something wrong?

My bad...
I had another session of Vscode runnign on the other screen and i didnt see it.
I closed all vscode session and reboot and it work
Thank you very much!

Related

Error executing "npm run test" with cypress

I'm learning cypress, but I came across this error.
When running npm run test the cypress window open for a while, but a couple seconds later it close, then this error appears:
I already installed the lastest cypress version and it didn't work.
Try running cypress cache clear and then npm install cypress --save-dev again.
then try running it with ./node_modules/.bin/cypress open.
Can you try these steps:
Delete node_modules folder
Run npm install -D cypress
Run npx cypress open
SOLVED: The problem was admin permission. When the blank window opened for a while, I clicked on the windows and authorized it again as adm. It worked!
I had authorized as adm before, but I don't know why it was happening.
Thanks you all guys for trying to help me.

about 'zsh react-native command not found' AFTER SETTING PATH

Some time ago, I had the command not found error when running expo, so I set path at ~/.bash_profile and so, after running source ~/.bash_profile, now I can call expo without problems.
Today, I tried running react-native link and the following error appeared:
zsh: react-native command not found
What else could I be doing wrong?
Maybe you don't have react native cli installed globally, which is good as it's not needed.
Check in the project directory if react-native is installed
so ./node_modules/react-native/ should exist and has something inside.
If so, you don't need to run react-native directly; try running through npx react-native or npm script.
If not, make sure you have react-native in package.json dependencies section, and run npm install to pull the react-native library folder.

'gulp' is not recognized

I'm completely new to Gulp but I wanted to try it out. Due to restrictions/admin rights on my desktop and moving about a lot, I need things portable, and so am currently running everything I need off a stick.
I've browsed similar posts but none of the solutions seemed to solve the problem I'm having.
I used the following commands in cmd with Ruby to install gulp -
npm install -g gulp
and then
npm install --save-dev gulp
I'm seeing the folders and files, but when I run gulp -v in cmd I get the following:
" 'gulp' is not recognized as an internal or external command, operable program or batch file."
I'm not sure if this is a problem related to the fact I don't have admin rights for this computer or not. Any help so I can troubleshoot further would be much appreciated!
E:\xampp\htdocs\wordpress>PATH
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\RailsInstaller\Git\cmd;C:\R
ailsInstaller\Ruby1.9.3\bin
Thanks
My Full Response
Solution
Re-download nodejs
npm install -g gulp
gulp -version
I had the same problem when I installed gulp, I was not able to run gulp in command line. I was getting the following error:
'gulp' is not recognized as an internal or external command,
operable program or batch file.
After doing some re-search I found that I needed to update the Path variable.
Following is the command you can run in command line to add the path to the system path variable.
C:\> PATH=%PATH%;C:\Users\**<username>**\AppData\Roaming\npm
Using VS2017, Net CORE 1.1 I received this error.
I ran the following in a command window at the root of my project:
cmd.exe /c gulp --tasks-simple
This showed me the real error in a stack trace: there was a typo in my gulpfile.js.
So for me the problem was a simple typo and had nothing to do with gulp, npm or installation.
Seems that you didn't configured the /bin folder of your node installation in the PATH variable, however in windows it should be done automatically. The PATH in your question refers to C:\Program Files\nodejs. You can add the environment variable manually or download the latest version and try again.
For those using linux, (if downloaded the Linux Binaries (.tar.xz)) please add, in your home (~/.bashrc), the export of node's bin folder, like:
export PATH=$PATH:/opt/node/bin
1- Check Is NPM Global installer installed the gulp or other package what you looking for
the default path is "C:\Users\YOUR_USER\AppData\Roaming\npm"
If the gulp executable on there you have installed it globally. If not install it globally. Like above right:
npm install -g gulp
2- Add it to windows environment system variables like that to working with it on your local IDE
NODE_PATH %AppData%\Roaming\npm\node_modules
GULP_PATH %AppData%\AppData\Roaming\npm
NPM_PATH %AppData%\AppData\Roaming\npm <- one of them
If someone is having this issue with an npm script that uses gulp, and with gulp as a dev dependency in your package.json, you shouldn't need to install gulp globally, I fixed it by doing a clean install.
npm ci
It sounds like theres some information missing, and while Im a bit confused about the 'commands in cmd with Ruby' this might set you down the right path.
After you install Gulp globally, as you did; npm install -g gulp, you want to cd into your project root and npm install gulp --save-dev. This is all outlined in this article, which is recommended alongside some other getting started articles by Gulp.

'ionic' is not recognized as an internal or external command

I have successfully installed Ionic. In fact, I have ran it many times already and it worked perfectly fine (on my browser using "ionic serve" command).. But when I have not done "Ionic stuffs" for a few days, and tried doing it this morning, the command is now unrecognized. What is wrong with this?
Running Windows 7 and ran into this issue myself. I ensured that I was running my command line as Administrator, cleaned the cache as suggested but continued to get the error that 'ionic' is not recognized...
After trying several other suggestions, I finally browsed to my nodejs location: C:\Program Files\nodejs
I ran the nodevars.bat to open the nodejs command prompt, ran the ionic command and everything worked as expected. I'm not sure what the issue is but running command from that .bat file appears to fix it.
I added this the path and all worked well.
%APPDATA%\npm;
I already solved it. :) For some unknown reason my ionic installation went MIA. And I didn't solve that directly, it had errors that says "Run as Administrator", etc when in fact I'm running Admin... The trick was to clean the cache before reinstalling Ionic using the npm cache clean command.
It had errors that says:
Run as Administrator
etc, when in fact I'm running as Admin... The trick was to clean the cache before reinstalling Ionic using the command:
npm cache clean
It worked for me. Just run npm command for cache clean and reinstall the ionic as:
npm install -g ionic
and it works perfectly fine.
After a couples days of this exact issue, I found my solution. Remove all of corodva with npm uninstall cordova and ionic with npm uninstall ionic. Then clear the cache with npm cache clear. View this for full removal https://stackoverflow.com/a/29429357/5144902
I then found that there was a couple folders still in my C:\Users\USERNAME\AppData\Roaming\npm. I could not remove this, as the file extension was too long. I opened cmd, and removed it with the DEL command. I then found that a node_modules folder was under my user folder. I removed that.
Then Global install with npm install -g ionic cordova. Works perfectly.
None of the solutions worked as permanent fix for me and it was pretty disgusting to use a fix every time I intended to use ionic. So, while browsing for a solution, I read some solutions that eventually led to this:
Go to your system settings->Advanced system settings->environment path. In my case, while the 'npm' was indeed added to the system path, it was separated by a single comma inspite of a colon (;). So, I replaced it with a colon and bingo! Please do restart your CMs before trying to test it. Hope it helps!
If you are on Windows, use Git Bash shell and have issues calling cordova and ionic,
maybe you'll have to add a path value to
c:\users[your username].bash_profile
this helped comparing windows path (cmd - echo %path%) with git bash shell path:
Git Bash doesn't see my PATH
for me, global paths were there, but user paths not. I had to add:
PATH=$PATH:/c/Program Files (x86)/Microsoft VS Code/bin:/C/Users/[my username]/AppData/Roaming/npm
answer here
İf "ionic" is installed;
1-Download and upgrade nodejs to latest version.
download nodejs
2- run command:
npm uninstall -g ionic
3-Clear these files:
C:\Users\user\AppData\Roaming\npm
C:\Users\user\AppData\Roaming\npm-cache
3-run command:
npm install -g #ionic/cli
İt is done:)
Go to nodejs installed directory ( in my case it's C:\Program Files\nodejs), then run the bat script "nodevars.bat" with administator permission. That solves my problem.
In the Windows environment, when we install packages with -g option they are not available sometimes while running the package through the command prompt. Steps below that worked for me —
Create a .npmrc file at C:\Users{username}\
Write below line in the .npmrc file. Write path as per the location of nodejs installed in your machine. Add double back slash wherever you have a back slash in the path.
prefix="D:\\programs\\nodejs"
Run the command to install the package again
npm install -g ionic
Run the new command
ionic serve
Variable Name: Path
Variable value: C:\Program Files\nodejs\bin
Try adding this to your user and environment variables , and then close the command prompt window and open.
The bin folder needs to be given for both user and environment variables
I got my problem resolved :)
You can uninstall as
npm uninstall -g ionic cordova
then clear cache
npm cache clean -f
then re-install as
npm install -g ionic cordova
Just go to your C:/users/(your name)/node_mudules, and uninstall node_mudules folder. Once uninstalled, open up node js command prompt and type
npm install -g ionic cordova
this worked for me

How to install and run lessc on top of node.js and Windows?

Hi I am learning LESS and I would like to install lessc on my Windows 7.
Following this tutorial http://verekia.com/less-css/dont-read-less-css-tutorial-highly-addictive
The first step is I dowloaded and installed node.js (node-v0.10.5-x64.msi).
Then in a console, I ran
npm install less -g
I got the following:
npm http GET https://registry.npmjs.org/less
npm http 304 https://registry.npmjs.org/less
npm http GET https://registry.npmjs.org/ycssmin
npm http 304 https://registry.npmjs.org/ycssmin
C:\Users\Me\AppData\Roaming\npm\lessc -> C:\Users\Me\AppData\Roaming\npm\node_modules\less\bin\lessc
less#1.3.3 C:\Users\Me\AppData\Roaming\npm\node_modules\less
+-- ycssmin#1.0.1
Then I ran the following in the same console:
lessc style.less > style.css
But I got
'lessc' is not recognized as an internal or external command, operable program or batch file.
I am not sure where I got wrong. I googled but it seems there is too much stuff, not sure which one is right. Did many tests without any success.
Could someone tell me how to do it or give me a pointer to some place with detailed and latest install info for Windows?
In a console, run the following:
node C:\Users\Me\AppData\Roaming\npm\node_modules\less\bin\lessc style.less > style.css
style.less must be in the console's directory.
step 1: npm install less -g
step 2: npm i less --save-dev
to get lessc working you have to add
C:\Users\Me\AppData\Roaming\npm
to the path
I guess you could add the bin folder in system properties -> advanced ->environment variables and append the whole path to the bin folder by edited the Path variable.
If you just installed node.js, the windows PATH variable won't be updated within any running CMD windows. Try closing CMD and reopening it!
I fixed this issue by using Node Version Manager (nvm) to install and use the latest version of Node.js
nvm install latest
nvm use 12.4.0
After that I navigated to my project folder and typed:
npm install less -g and then
npm i less --save-dev
Finally I typed lessc less/index.less css/index.css to compile my less.
If you are using windows, don't forget to open the command line console as an administrator.
After spending around number of hours hunting around to compile less files, I got very simple answer:
download node-v0.10.26-x64.msi for windows users -> install it -> then
go to any folder(in command prompt) where *.less files are located and run the command
"lessc styles.lsss > styles.css". (Example: in command prompt, less is my less folder where *.less files exist)
D:\less>lessc styles.less > styles.css
now you will get styles.css files created automatically. Open and see styles.css file
Well, you must have NodeJS installed on your machine, use this link to download and install it.
Once installed make sure to restart your machine.
Then check whether it is properly installed by running "node -v" and "npm -v" in CMD.
Once that is done run "npm install less -g" and you are ready to compile your less files.
Just go into the directory where your files are and run "lessc style.less style.css"
More can be found on this link.

Resources