Skip to content

Angular npm start error #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
barrantesj1952 opened this issue Jan 25, 2021 · 2 comments
Closed

Angular npm start error #147

barrantesj1952 opened this issue Jan 25, 2021 · 2 comments

Comments

@barrantesj1952
Copy link

when I try to run the application with npm start I got an error.
Searching in google I found a solution "delete node_modules", "npm install" but I keep getting the error below.
roberto@Administrators-MacBook-Pro APM % npm start

[email protected] start /Users/Shared/Previously Relocated Items/Security/Repositories/TypeScript/GettingStartedRB/APM
ng serve -o

The serve command requires to be run in an Angular project, but a project definition could not be found.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: ng serve -o
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start 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! /Users/roberto/.npm/_logs/2021-01-25T19_40_58_333Z-debug.log
roberto@Administrators-MacBook-Pro APM %


log error
-------------------------------------------------------0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]
6 info lifecycle [email protected]
start: [email protected]
7 verbose lifecycle [email protected]start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/Shared/Previously Relocated Items/Security/Repositories/TypeScript/GettingStartedRB/APM/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
9 verbose lifecycle [email protected]
start: CWD: /Users/Shared/Previously Relocated Items/Security/Repositories/TypeScript/GettingStartedRB/APM
10 silly lifecycle [email protected]start: Args: [ '-c', 'ng serve -o' ]
11 silly lifecycle [email protected]
start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: ng serve -o
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/Shared/Previously Relocated Items/Security/Repositories/TypeScript/GettingStartedRB/APM
16 verbose Darwin 20.2.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v10.16.1
19 verbose npm v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: ng serve -o
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

@DeborahK
Copy link
Owner

A few things to try:

Things to try:

  1. Did you run npm install successfully? The project files must first be installed before you can use npm start to start the project.

  2. Ensure that there is a package.json file in the folder.

  3. Try cleaning your npm cache:

  • Run npm cache verify
  • Delete your node_modules folder and package-lock.json file (if they exist in the project folder)
  • Run npm install again.
  1. If that doesn't work, double check your version of npm. Ensure you install the LTS version of node (with npm) and not the "current" version, which seems to have more issues. Then repeat npm install not working #1.
    NOTE: I have node v12. Looks like you have v10. Though the Angular docs say "node": ">= 10.13.0", so your version should work.

  2. I've heard that some people with very long paths to the Angular files have had trouble in the past: /Users/Shared/Previously Relocated Items/Security/Repositories/TypeScript/GettingStartedRB/APM You could try moving the code to another folder with a shorter path and then repeat npm install not working #1.

Let me know if any of these options worked for you.
All the best -

@DeborahK
Copy link
Owner

DeborahK commented Feb 5, 2021

Did you have any luck with this? I'm closing it for now. Feel free to re-open if none of the above resolved your issue.

@DeborahK DeborahK closed this as completed Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants