Angular JS 2 can't be installed, why? - javascript

I have tried setting up Angular 2 to experiment with on my VPS. The needed steps are here:
https://angular.io/docs/js/latest/quickstart.html
The first command is successful:
$ npm install -g tsd#^0.6.0
But the second step causes an error:
tsd install angular2 es6-promise rx rx-lite
"/usr/bin/env: node: No such file or directory" is the error I get. I have tried installing this in my project folder as root, but that also didn't had success. Does someone know why I get this error? The command doesn't exist, but why not?
Is there an easier way to install this? I have seen "npm install angular2", but I don't know how that works, that's why I tried the steps

You may need to make a symbolic link to node:
ln -s /usr/bin/nodejs /usr/bin/node
(see https://stackoverflow.com/a/26320915/2033574)

Related

How could the vue-cli-service crash because of the '#vue/cli-plugin-babel' module, if the node module is there?

Some background:
I started my project with a clone of this repository. Here's an example of the code. After some time, I realized that the vue-cli-service it used appeared to be old. (They even renamed it to '#vue/cli-service'). So, I ran npm update. The code has me use npm run serve to start the service. It's apparently equivalent to npx vue-cli-service serve. When I did that, it couldn't load some bootstrap stuff. I reinstalled bootstrap (npm install bootstrap#version (don't have access to the exact line I used). It then said it couldn't find '#vue/cli-plugin-babel'. I saw it right in the node_modules folder.
I fixed it using this process:
I ran npm update.
It first said that it could not find a font (no longer have the specific details). The error directed to the bootstrap.css file.
I reinstalled bootstrap.
I run npm run serve, and it says "Cannot find module '#vue/cli-plugin-babel'"
I see '#vue/cli-plugin-babel' showing in the node_modules folder
I run npm list --depth=0, and '#vue/cli-plugin-babel' does not show up.
I*’m seeing this
npm cache clean --force alone did not cause the site to resume. It still said “ Cannot find module '#vue/cli-plugin-babel'”.
Following the top SO answer here got my site to work again.
rm -rf node_modules/
npm cache clean (then replaced with npm cache verify on npm's prompt)
npm install (I wonder if it was possible to ignore ‘rm -rf node_modules/’ and just do the last two steps).
I run npm run serve, and the site works again.
After running npm list --depth=0 again, there are no more UNMET DEPENDENCY issues, like with #6.
Also on that SO Q&A, people talked about restructuring (reordering) the package.json file. In the top answer he says that a possible solution is to “Re-structure your package.json. Place all the high-level modules (serves as a dependency for others modules) at the bottom.”. I wonder if that relates to my issue.
My expected vs. actual results:
When I updated it, I actually sort of expected it to break. I got that.
But what I also expected was:
If the node module is there, it will not give me an error.
If I run npm install, all dependencies will be handled automatically.
If npm install doesn't do the trick, then npm cache clean --force should do the trick. (Note: I later learned about npm cache verify).
I got:
The '#vue/cli-plugin-babel' module was there and it gave an error saying it couldn't find it.
(And also 3.) Running npm install and npm install [unmet-dependency] did not work until after 'rm -rf node_modules/' -> `npm verify cache' and THEN -> 'npm install'.
Here are my guesses:
#vue/cli service doesn’t check the folders directly to see if a module exists (75% chance it’s true)
#vue/cli service uses a proxy, something like the packages.json file (but different) to see if a node exists (40%).
#vue/cli service caches commonly used stuff. So, when I ran it again after the update, it didn’t check the new stuff in my folder, it checked its cache. It didn’t line up. (10%).
For everything above, replace #vue/cli service with npm (10%).
Again, my biggest question is "How could the vue-cli-service crash because of the '#vue/cli-plugin-babel' module, if the node module is there?"
And "How did removing the node_modules folder, verifying the cache, and reinstalling with npm cause npx vue-cli-service serve to successfully run my site again (and find #vue/vue-plugin-babel)?".

ubuntu 18.04- ember: command not found

I know this has been addressed before, but I've tried the advice on No command 'ember' found and it hasn't worked for me.
I'm trying to install EmberJs for a techtest and I keep getting 'Command 'ember' not found'. I'm on Ubuntu 18.04, and have checked all my paths as follows.
When I run npm install -g ember-cli it installs and shows:
npm WARN deprecated exists-sync#0.0.4: Please replace with usage of
fs.existsSync
/home/[user]/.npm-global/bin/ember ->
/home/[user]/.npm-global/lib/node_modules/ember-cli/bin/ember
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4
(node_modules/ember-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current:
{"os":"linux","arch":"x64"})
+ ember-cli#3.5.0
updated 1 package in 14.662s
So I've definitely got it installed.
When I run which npm/ which node I get the following respectively:
/usr/bin/npm
/usr/bin/node
When I run echo $PATH I get:
/home/[user]/npm_global/bin:/usr/local/share/npm/bin:
/usr/local/bin:/usr/local/sbin:~/bin:/usr/share/rvm/gems/ruby-2.3.7/
bin:/usr/share/rvm/gems/ruby-2.3.7#global/bin:/usr/share/rvm/rubies/
ruby-2.3.7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
sbin:/bin:/usr/games:/usr/local/games:/usr/bin:/snap/bin:/usr/
share/rvm/bin
Andddd I have these paths in my bashrc:
export PATH="/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
and
export PATH="/home/[user]/npm_global/bin:$PATH"
I realise this is a lot of info, I'm new to this so wanted to give as much as I could. Any suggestions very much appreciated, thank you!
The error you are experiencing means that ember is not in the path. It's really irrelevant if you've installed with npm or downloaded the files manually for the purposes of properly setting up your path. When you encounter a PATH issue the solution is quite simple.
Find the executable. find / -name ember if you want to include symlinks, or just find -type f -name ember if you want only the actual location (npm installs will install in their own managed directory and then symlink to the typical location for binary files such as /usr/local/bin on macOS)
Once found, use your shell's properties file like bashrc to append the directory containing the executable to the $PATH variable.
It's as simple as that. Binary files that are found in your $PATH can be executed. Make sure you see the path to ember there, or manually add the full path that you find in step 1 to your $PATH in bashrc with export PATH=$PATH_TO_DIR_WITH_EMBER_BIN:$PATH which concatenates to the existing $PATH variable

React Native Config.h not found

I'm beginner of React native developer.
After create new project then open it.
xcode is display error config.h file not found in mutex.h file. I'm also search in google and try possible solution but still display same error.
I'm done Following Commands
1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2
brew install watchman
3
npm install -g react-native-cli
4
react-native init projectName
5
cd projectName
react-native start
6
react-native run-ios
Error in CMD
./Desktop/Demo React Native/projectName/node_modules/react-native/React/../third-party/glog-0.3.4/src/base/mutex.h:105:10: fatal error: 'config.h' file not found
include "config.h" // to figure out pthreads support
1 error generated.
Software Version List
Homebrew 1.6.8
react-native-cli: 2.0.1
react-native: 0.55
watchman 4.9.0
npm 6.1.0
I'm also try this soluation but still error
In the Terminal, navigate to the third-party/glog and config glog file
cd node_modules/react-native/third-party/glog-0.3.4
./../scripts/ios-configure-glog.sh
I got it fixed by following this steps:
Close Xcode.
cd <Project-Folder>/node_modules/react-native/third-party/glog-0.3.4
Run ./configure
Run make
Run make install
Open Xcode and try building the Project.
Hope this solves the issue
Solution:
yarn upgrade log
Upgrade to v1.6.0 successful. iOS build successful.
Note: Rebuilding glog did did not work for me. Build failed.
I will add another answer to this issue since it was driving me crazy this week...
$ cd ./node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd $(ls | grep 'glog' | awk '{print $1}') && ./configure
The steps needed to manually configure glog (like samridhgupta his accepted answer or the command I wrote here just above) worked for me, but only the first time I build the project. On every single build I had to go to the same process so I needed a more stable solution.
I appears Xcode is executing ios-install-third-party.sh on every build, which means it will also execute ios-configure-glog.sh every single time. So my solution is to just build a single time, and then comment out the glog install step in the ios-install-third-party script.
If anyone is facing this same issue, it is the line below you need to remove or comment out (ios-install-third-party can be found in /node_modules/react-native/scripts).
fetch_and_unpack glog-0.3.5.tar.gz https://github.com/google/glog/archive/v0.3.5.tar.gz 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc "\"$SCRIPTDIR/ios-configure-glog.sh\""
If any of these solution does not work, please check your project path. Project path - directory names should not contain any space in its name or you can create project on Desktop or in Documents directory.
Run following commands in project directory.Helped me resolve my config.h not found issue
cd node_modules/react-native/third-party/glog-0.3.4/
./configure
make
make install
cd ../../../..
react-native run-ios
Add this fix script into package.json
"scripts": {
"fix": "cd node_modules/react-native/third-party/glog-0.3.4 && ./configure && make && make install"
},
Then run yarn fix or npm run fix and then try building the Project
My problem was comming from using react-native#0.53.0, which I suppose has trouble with new Xcode version.
1 - Change react-native version in package.json
"react-native": "0.53.0",
to
"react-native": "0.56.0",
2 - Remove node_modules folder
$ rm -rf node_modules/
3 - Reinstall modules:
$ yarn install
What worked for me:
yarn cache clean
rm -rf node_modules
yarn install

running lines in my node.js command prompt

I am new to node.js and Github. I was trying to save some work by using command git add -A and the then I saw these lines below and some many of the lines are just running non-stop. I typed ctrl+c to stop it, but anyone knows what are just happened or what did I do wrong??
Thanks
This is because of how git treats the space character.
Find more info here: https://stackoverflow.com/a/1967986/2874959
Thanks #bcorbella for the answer. Just a small precision to be sure you won't do this as a beginner but never add the node_modules into your git project. Create a .gitignore file with at least:
node_modules
Use npm init, npm install <module> --save to create a package.json... then do simply a npm install when you are checking your project.
More info in here https://docs.npmjs.com/getting-started/using-a-package.json
try setting the config core.eol to native and see if you will get the same error, i see no reason why you should be tracking the node_modules/ folder.
> git config --global core.eol native

Cannot Install Bower - Syntax Error

First off, I am a complete novice. I have just started learning programming today and I am trying to learn jQuery. But in order to use jQuery I have had to get bower and npm (node), which has been a confusing ordeal. So I downloaded node:
Node was installed at
/usr/local/bin/node
npm was installed at
/usr/local/bin/npm
Make sure that /usr/local/bin is in your $PATH.
Then I read:
Install Bower globally using NPM.
npm install -g bower
Which I tried doing in Chrome with Javascript. Then I read on this site that appropriate syntax is:
$ npm config set prefix /usr/local
$ npm install -g bower
I have tried a bunch of others too, all the same error
SyntaxError: Unexpected identifier
So I'm a newbie that needs some expert guidance on this trivial programming because I am making a mistake somewhere and I have no idea what it is I am doing wrong.
Your error message indicates that you are typing your npm command at a JavaScript prompt. It is not a JavaScript function, it is a separate program. Type it at your normal (e.g. bash) command prompt.
That said, you do not need to go anywhere near Node.js in order to use jQuery. It is most commonly used inside a webpage, not in a Node.js application. See the getting started guide on the jQuery website.

Categories