ng new issue - unable to scaffold a new angular app - javascript

I've just updated the angular-cli
If I check the terminal with ng -v this is what i get:
Angular CLI: 1.6.1
Node: 8.6.0
OS: darwin x64
Angular:
...
When I try to scaffold a new angular application with the following command
ng new my-app
I get the following error message:
Error: obs.pipe is not a function
obs.pipe is not a function
I've tried to install and uninstall the cli several times but still I can't solve the issue.

I had the exact same error when using the following command
ng g module <module-name>
Turns out my problem was a mismatch between the global angular cli version and the local one. Running
npm install -save-dev #angular/cli#latest
solved it for me. (I ran it in the parent directory to the project I was using, but it should work in the same directory also).

Related

can't create react-native app with npx react-native init command

whenever I try to start a new project with npx react-native init command I get the following error:
> error Error: Command failed: yarn init -y
> Usage: yarn [options]
>
> yarn: error: no such option: -y
I have linux mint OS and when I try to create a new react natove app with expo everything works fine., when I try to run same command with sudo but then I got
sh: 1: react-native: Permission denied
I have linux mint OS and when I try to create a new react native app with expo everything works fine. I have 16.17.1 version of Node and I tried to remove react native CLI and reinstalling it but couldn't sort this problem out. What causes this error and how can I solve this problem?
okay seems like I had old version of yarn after updating yarn to the last version I solved the problem.

Installing Create React App with Typescript Support Via Yarn error

I'm trying to create a new Typescript/React project and am running into the following error:
Installing template dependencies using yarnpkg...
yarn add v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
error expect#29.0.2: The engine "node" is incompatible with this module. Expected version "^14.15.0 || ^16.10.0 || >=18.0.0". Got "17.4.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
`yarnpkg add #testing-library/jest-dom#^5.14.1 #testing-library/react#^13.0.0 #testing-library/user-event#^13.2.1 web-vitals#^2.1.0` failed
Done in 25.21s.
To create my react project, I'm running the following command yarn create react-app my-app --template typescript per the Create React App docs.
Any help would be appreciated.
My version of node was oudated. I upgraded yarn and node using:
nvm install node --reinstall-packages-from=node
yarn install -g

cannot be loaded because running scripts is disabled on this system when installing angular

I have downloaded nodejs (v14.16.0) on my pc and I tried to install angular using this command: npm install -g #angular/cli
But when I try to check the version of the angular using command ng version it is showing me this error:

create-react-app Error: Cannot find module 'react-scripts/scripts/init.js'

Everytime I try to create a brand new project with create-react-app I get this error:
Error: Cannot find module 'react-scripts/scripts/init.js'
Screenshot
THE WAY I CREATE PROJECT:
npx create-react-app new-project
node -v v12.13.1
npm -v 6.12.1
OS Win10
already tried:
npm uninstall -g create-react-app
different project paths
by the way:
the problem disappears when I use --use-npm flag
Any ideas what the reason can be?
Open your command prompt and type "node -v" as well as "npm -v", What do you get there as a response?
Here i found an answer to the same issue, https://stackoverflow.com/a/63334241/7857368
have your tried creating the app with npx create-react-app myapp you don't need to install the create-react-app globally anymore with this command.
Try running the following commands:
npm install
npm install react-scripts
npx create-react-app App-name
React-scripts issue is issue with webpack and babel mostly. You should
create a brand new project using npx create-react-app projectName and this is the recommended approach. This way you don't have to globally install create-react-app in your machine which was previous approach.
Have a look at the documentation. https://reactjs.org/docs/create-a-new-react-app.html
NOTE:
For npx create-react-app projectNameto work. Your node and npm
should be: Node >= 8.10 and npm >= 5.6
And you will have to uninstall old create-react-app from the
machine. See the doc: https://create-react-app.dev/docs/getting-started

Initializing angular project fails

I am trying to set up angular project from scratch.
Below are the steps followed
Installed Node js
Installed Angular CLI using npm install -g #angular/cli#latest
Versions
Angular CLI: 9.1.4
Node: 12.16.3
OS: win32 x64
Angular:
...
Ivy Workspace:
Package Version
#angular-devkit/architect 0.901.4
#angular-devkit/core 9.1.4
#angular-devkit/schematics 9.1.4
#schematics/angular 9.1.4
#schematics/update 0.901.4
rxjs 6.5.4
Created a new app using ng new app_name
While trying to run the app through command ng serve I am getting a host of errors and app is not starting up
Have attached screen shot of the error
edit
If you use angular 9.1.6 it should be fine now
npm update #angular/cli #angular/core
original post
I had the same problem after making a fresh project using
npm install -g #angular/cli
ng new <projectname>
I believe its a bug in 9.1.5 Angular when using the 9.1.4 cli
You'll see the issue when you do
ng --version
if you get:
Angular CLI: 9.1.4
Node: 12.16.3
OS: win32 x64
Angular: 9.1.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
To resolve you install 9.1.4 Angular instead by running after you've done your
ng new <projectname>
then run
npm install #angular/core#9.1.4 #angular/animations#9.1.4 #angular/common#9.1.4 #angular/forms#9.1.4 #angular/platform-browser#9.1.4 #angular/router#9.1.4 #angular/platform-browser-dynamic#9.1.4 #angular/compiler#9.1.4 #angular/compiler-cli#9.1.4 #angular/language-service#9.1.4
ng build
See my other answer for reference
ERROR in TypeError: Cannot read property 'flags' of undefined

Categories