I am trying to learn how to use CLI and am very new to Javascript, so my apologies in advance.
I'm running WSL Ubuntu for a class and trying to code in VSCode. I'm running into an error where I want to open the index.html file in my google chrome browser using the CLI so I figure I should use the 'start' command. I type into the VSCode terminal 'start index.html' and receive the following error:
/mnt/c/MinGW/msys/1.0/bin/cmd: 8: : Permission denied
My research tells me I need to use chmod somewhere but I'm at a loss of where or exactly what I should be doing with it.
Thanks
If you use WSL better source directory use better in WSL path.
My case is all working directory in WSL, and Termial start in WSL $home.
ex) git, npm, python, php etc. I just install all in WSL.
even If can access able windows folder will be slow.
my recommand is all command or tool install in WSL also work directory
First of all, I wanted to learn Node.js, I opened my code editor then logged a simple word. but the problem is when I open my terminal I write :
node server.js
but it says :
'node' is not recognized as an internal command
or external, an executable program or a batch file.
I don't know how to fix the problem even in my editor's terminal.
Seems you haven't installed node on your system. Be sure if you have installed node or not.
Just open your terminal and type node
If you don't see a message like this Welcome to Node.js v14.12.0. then check this official download/setup link.
If you're using Ubuntu, then follow this link.
For any other Linux distro, just search Install node on <manjaro>.
Change with your distro name.
I am following the tutorial on the official React Native website.
Using the following to build my project:
react-native run-ios
I get the error:
Found Xcode project TestProject.xcodeproj
xcrun: error: unable to find utility "instruments", not a developer
tool or in PATH
Command failed: xcrun instruments -s
xcrun: error: unable to find utility "instruments", not a developer
tool or in PATH
Although, when I run the app from the .xcodeproj, everything works fine.
Any suggestions?
Check out this link (Running react-native run-ios occurs an error?). It appears to be a problem with the location of Command line tools.
In Xcode, select Xcode menu, then Preferences, then Locations tab. Select your Xcode version from the dropdown and exit Xcode.
You may need to install or set the location of the Xcode Command Line Tools.
Via command line
If you have Xcode downloaded you can run the following to set the path:
sudo xcode-select -s /Applications/Xcode.app
If the command line tools haven't been installed yet, you may need to run this first:
xcode-select --install
You may need to accept the Xcode license before installing command line tools:
sudo xcodebuild -license accept
Via Xcode
Or adjust the Command Line Tools setting via Xcode (Xcode > Preferences > Locations):
An update for anybody (like me) who's run into this in Xcode 13 -- the instruments command has been removed.
Updating to the latest version of react-native in your package.json file will no longer try to use the instruments command.
By default, after installing Xcode command-line not selected, so open Xcode and go to Preferences >> Locations and set Command Line Tools...
This worked for me in MAC High Sierra, Xcode Version 9.3:
Press i to open iOS emulator...
And You can see a cool new iPhone simulator like below image:
In my case the problem was that Xcode was not installed.
I had to accept the XCode license after my first install before I could run it. You can run the following to get the license prompt via command line. You have to type agree and confirm as well.
sudo xcodebuild -license
Problem is your Xcode version is not set on Command Line Tools, to solve this problem open Xcode>Menu>preferences> location> here for Command Line tools select your Xcode version, that's it.
For those like me who come to this page with this problem after updating Xcode but don't have an issue with the location setting, restarting my computer did the trick.
For me, it turns out that there was an iOS system update pending asking to restart the computer. Restart and let the update finish solved my problem.
In my case the SDKROOT environment variable was wrong, which referred to an old version of iPhoneOSxx.x.sdk. (Perhaps this would have automatically resolved itself after a reboot?)
You can check by running echo $SDKROOT and verifying that it's a valid path.
I fixed it by updating in .bash_profile:
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk
None of these solutions worked for me. These two similar problems offer temporary solutions that worked, it seems the simulator process isn't being shutdown correctly:
Killing Simulator Processes
From https://stackoverflow.com/a/52533391/11279823
Quit the simulator & Xcode.
Opened Activity monitor, selected cpu option and search for sim, killing all the process shown as result.
Then fired up the terminal and run sudo xcrun simctl erase all. It will delete all content of all simulators. By content if you logged in somewhere password will be gone, all developer apps installed in that simulator will be gone.
Opening Simulator before starting the package
From https://stackoverflow.com/a/55374768/11279823
open -a Simulator; npm start
Hopefully a permanent solution is found.
Go to Xcode Preferences
Locate the location tab
Set the Xcode version in Given Command Line Tools
Now, it ll successfully work.
If the previous answers didn't help you, you're probably dealing with an outdated react-native version. If you want to run your app on device without upgrading React-Native, you'll have to run the app directly from Xcode instead of doing it in the CLI. So open the <appname>.xcworkspace, select your device on the right-hand dropdown and press the "Run" icon.
Xcode screenshot
In Mac: After all, you are getting this issue, there may be a chance of missing the following in System Preferences -> Network -> Ethernet -> Select Advanced -> Proxies
add the following line,
*.local,localhost
This is how I got the solution,
> rm -rf ~/Library/Developer/Xcode/DerivedData
> sudo rm -rf /Library/Developer/CommandLineTools
> xcode-select --install
> sudo xcodebuild -license accept
Xcode > Preferences > Location > Command Line Tools choose.
simply go to Xcode
click on Xcode from the top left menu
Xcode->preferences-> location-> click comman line option and set Xcode version.
For any such problem:
Go to .expo folder
Find apk-cache
Remove that folder
and you are done..
Hope it helps?
Note: I have tried almost all similar posts related to this issue and found nothing was helpful to me. Hence posting this.
Issue: I'm trying to install http-server package in my Windows 7 machine using npm install http-server -g, Installation was fine, however when I try to execute it using http-server command in the command line I'm getting an error saying, 'http-server' is not recognized as an internal or external command, operable program or batch file. I have also tried the same steps for gulp and the result was the same.
I have tried setting the Node Path as, set NODE_PATH=%AppData%\npm\node_modules; but no luck.
Can someone shed some light here?
Thanks,
Dave
Global packages needs to be installed using and administration console (CMD / Run as Administrator)
My NodeJs is working fine but i have an issue I'm not seeing $ in the prompt as most example point.
Another issue is when i put sudo I dont get anything.Things I have tried are the following
$ sudo npm install npm -g
/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
npm#2.7.1 /usr/lib/node_modules/npm
given on the following Website
http://www.tutorialspoint.com/nodejs/nodejs_npm.htm
Apologies am very new to Node.JS.Please help
I'm going to explain this in terms familiar to MS windows.
$ npm --version
^ dollar sign is the same as "C:\" in windows.
It just means "from here..." in the most basic terms I can use.
You don't need the dollar sign for anything in that tutorial.
"sudo" means "elevate to an administrator level" similar to opening a command line terminal "in administrator mode." But for Linux (Ubuntu and Mac as *NIX) systems.
--version can be called as "-v" most of the time and means "for the thing I've named before, in this case "npm" show me the version.
Once you've installed NodeJS it comes with a "package manager" called NPM. The best way to relate this to windows is by considering it a command line version of an "installation" that installs different programs as you tell it to with different options.
"npm install -g" means "Hey NPM! Install to EVERYWHERE(call from command line/terminal/bash) the thing I Tell you next. "npm install -g express" for example, means hey NPM, install "expressJS" globally, so I can use the terminal to write commands(micro apps) from the expressJS I just installed with node.
"npm install --save" means hey, install this microapp, but ONLY let me use it in THIS EXACT FOLDER I'm in, and let anyone else that is in this folder know they need to install it to use this application I'm making.
"npm init" Is actually the FIRST thing you should do in any node project folder. It creates the "package.json" file in the current directory, and it will define the folder you're in as the folder to start installing stuff you "npm install" to the "node_modules" folder that will show in the folder you're currently in.
If you want to tinker with NodeJS code, and you don't want to tamper with your local machine and install all kinds of stuff you're not totally sure about yet you can use "REPL.it" (https://repl.it/languages/nodejs) the white window on the right is treated like a file you'd run in node. The dark window on the right is an actual NODE TERMINAL that you can run nodejs commands/code in directly.
There's one other good resources in general and that is here (https://devdocs.io/) it's called "Devdocs" and it has Node, npm, and express code examples, clean explanations, and examples that you can download directly to your local machine.
I hope that gets you moving with NodeJS. It's hard to understand, but with a bit of try and fail you'll start to try more and fail less. Cheers!