can't run npm to serve "lite-server

630 views
Skip to first unread message

Janis Rough

unread,
Jul 5, 2017, 7:06:37 PM7/5/17
to Angular and AngularJS discussion
I have installed lates update of npm.  I have done npm run build.    I have enclosed the log.  Is it something to do with my export path?  see lines between 9 and 10.  It should be reading the config file.   Also below is my config file.   I don't know what to try. TIA


------log----

 info it worked if it ends with ok

1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]

2 info using n...@4.6.1

3 info using no...@v7.10.0

4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]

5 info lifecycle angular-q...@1.0.0~prebuild: angular-q...@1.0.0

6 silly lifecycle angular-q...@1.0.0~prebuild: no script for prebuild, continuing

7 info lifecycle angular-q...@1.0.0~build: angular-q...@1.0.0

8 verbose lifecycle angular-q...@1.0.0~build: unsafe-perm in lifecycle true

9 verbose lifecycle angular-q...@1.0.0~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/jrough/project/Demo/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

10 verbose lifecycle angular-q...@1.0.0~build: CWD: /Users/jrough/project/Demo

11 silly lifecycle angular-q...@1.0.0~build: Args: [ '-c', 'tsc -p src/' ]

12 info lifecycle angular-q...@1.0.0~build: Failed to exec build script

13 verbose stack Error: angular-q...@1.0.0 build: `tsc -p src/`

13 verbose stack spawn ENOENT

13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:33:16)

13 verbose stack     at emitTwo (events.js:106:13)

13 verbose stack     at ChildProcess.emit (events.js:194:7)

13 verbose stack     at maybeClose (internal/child_process.js:899:16)

13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

14 verbose pkgid angular-q...@1.0.0

15 verbose cwd /Users/jrough/project/Demo/src

16 verbose Darwin 16.6.0

17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"

18 verbose node v7.10.0

19 verbose npm  v4.6.1

20 error file sh

21 error code ELIFECYCLE

22 error errno ENOENT

23 error syscall spawn

24 error angular-q...@1.0.0 build: `tsc -p src/`

24 error spawn ENOENT

25 error Failed at the angular-q...@1.0.0 build script.


----config----

{

  "name": "angular-quickstart",

  "version": "1.0.0",

  "description": "QuickStart package.json from the documentation, supplemented with testing support",

  "scripts": {

    "build": "tsc -p src/",

    "build:watch": "tsc -p src/ -w",

    "build:e2e": "tsc -p e2e/",

    "serve": "lite-server -c=bs-config.json",

    "serve:e2e": "lite-server -c=bs-config.e2e.json",

    "prestart": "npm run build",

    "start": "concurrently \"npm run build:watch\" \"npm run serve\"",

    "pree2e": "npm run build:e2e",

    "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",

    "preprotractor": "webdriver-manager update",

    "protractor": "protractor protractor.config.js",

    "pretest": "npm run build",

    "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",

    "pretest:once": "npm run build",

    "test:once": "karma start karma.conf.js --single-run",

    "lint": "tslint ./src/**/*.ts -t verbose"

  },

  "keywords": [],

  "author": "",

  "license": "MIT",

  "dependencies": {

    "@angular/common": "~4.0.0",

    "@angular/compiler": "~4.0.0",

    "@angular/core": "~4.0.0",

    "@angular/forms": "~4.0.0",

    "@angular/http": "~4.0.0",

    "@angular/platform-browser": "~4.0.0",

    "@angular/platform-browser-dynamic": "~4.0.0",

    "@angular/router": "~4.0.0",


    "angular-in-memory-web-api": "~0.3.0",

    "systemjs": "0.19.40",

    "core-js": "^2.4.1",

    "rxjs": "5.0.1",

    "zone.js": "^0.8.4"

  },

  "devDependencies": {

    "concurrently": "^3.2.0",

    "lite-server": "^2.2.2",

    "typescript": "~2.1.0",


    "canonical-path": "0.0.2",

    "tslint": "^3.15.1",

    "lodash": "^4.16.4",

    "jasmine-core": "~2.4.1",

    "karma": "^1.3.0",

    "karma-chrome-launcher": "^2.0.0",

    "karma-cli": "^1.0.1",

    "karma-jasmine": "^1.0.2",

    "karma-jasmine-html-reporter": "^0.2.2",

    "protractor": "~4.0.14",

    "rimraf": "^2.5.4",


    "@types/node": "^6.0.46",

    "@types/jasmine": "2.5.36"

  },

  "repository": {}

}


Lucas Lacroix

unread,
Jul 5, 2017, 8:32:09 PM7/5/17
to Angular and AngularJS discussion

The error, "NOENT", usually indicates a missing file or directory. Are you sure the "src" folder exists?


--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
--
Lucas Lacroix
Computer Scientist
Advanced Technology Division, MEDITECH

Janis Rough

unread,
Jul 6, 2017, 10:02:00 AM7/6/17
to Angular and AngularJS discussion
src is a directory not a file:  I tried npm start from one level up where is the package.json file  . tried npm start and got this error from the log

---log---

0 info it worked if it ends with ok

1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]

2 info using n...@5.0.4

3 info using no...@v7.10.0

4 verbose run-script [ 'prestart', 'start', 'poststart' ]

5 info lifecycle angular-q...@1.0.0~prestart: angular-q...@1.0.0

6 verbose lifecycle angular-q...@1.0.0~prestart: unsafe-perm in lifecycle true

7 verbose lifecycle angular-q...@1.0.0~prestart: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/jrough/project/Demo/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

8 verbose lifecycle angular-q...@1.0.0~prestart: CWD: /Users/jrough/project/Demo

9 silly lifecycle angular-q...@1.0.0~prestart: Args: [ '-c', 'npm run build' ]

10 silly lifecycle angular-q...@1.0.0~prestart: Returned: code: 1  signal: null

11 info lifecycle angular-q...@1.0.0~prestart: Failed to exec prestart script

12 verbose stack Error: angular-q...@1.0.0 prestart: `npm run build`

12 verbose stack Exit status 1

12 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)

12 verbose stack     at emitTwo (events.js:106:13)

12 verbose stack     at EventEmitter.emit (events.js:194:7)

12 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)

12 verbose stack     at emitTwo (events.js:106:13)

12 verbose stack     at ChildProcess.emit (events.js:194:7)

12 verbose stack     at maybeClose (internal/child_process.js:899:16)

12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

13 verbose pkgid angular-q...@1.0.0

14 verbose cwd /Users/jrough/project/Demo

15 verbose Darwin 16.6.0

16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"

17 verbose node v7.10.0

18 verbose npm  v5.0.4

19 error code ELIFECYCLE

20 error errno 1

21 error angular-q...@1.0.0 prestart: `npm run build`

21 error Exit status 1

22 error Failed at the angular-q...@1.0.0 prestart script.

22 error This is probably not a problem with npm. There is likely additional logging output above.

23 verbose exit [ 1, true ]





---

sh-3.2# vi package.json

this is the package.json file.  it is up one directory in the demo file.  There is no other files except package.json.

Lucas Lacroix

unread,
Jul 6, 2017, 10:06:01 AM7/6/17
to Angular and AngularJS discussion

You need to run npm from the directory where the package.json lives. All paths in your configuration must be relative to that location.

Does that make sense?


--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Janis Rough

unread,
Jul 6, 2017, 12:34:25 PM7/6/17
to Angular and AngularJS discussion
Okay, I reinstalled the demo directory.  I ran sudo npm install on top directory,, didn't get an error.   Then I do the command "npm start".  Still get the same error as before.  I am in the right directory  under demo same directory as package.json it should launch the package.json.

npm start

npm ERR! path /Users/jrough/package.json

npm ERR! code ENOENT

npm ERR! errno -2

npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/Users/jrough/package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent 


npm ERR! A complete log of this run can be found in:

npm ERR!     /var/root/.npm/_logs/2017-07-06T16_27_44_505Z-debug.log



sh-3.2# 


---log---


 info it worked if it ends with ok

1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]

2 info using n...@5.0.4

3 info using no...@v7.10.0

4 verbose stack Error: ENOENT: no such file or directory, open '/Users/jrough/package.json'

5 verbose cwd /Users/jrough/project

6 verbose Darwin 16.6.0

7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"

8 verbose node v7.10.0

9 verbose npm  v5.0.4

10 error path /Users/jrough/package.json

11 error code ENOENT

12 error errno -2

13 error syscall open

14 error enoent ENOENT: no such file or directory, open '/Users/jrough/package.json'

15 error enoent This is related to npm not being able to find a file.

16 verbose exit [ -2, true ]

~                                                                                                        

~                              

Lucas Lacroix

unread,
Jul 6, 2017, 12:51:52 PM7/6/17
to Angular and AngularJS discussion

Only use sudo with no if you are installing modules globally. What you've done is, potentially, made the node_modules folder inaccessible.

According to line 14, you're running "npm start" from your user's directory instead of a project specific folder. That seems very strange.

Janis Rough

unread,
Jul 7, 2017, 2:19:30 PM7/7/17
to Angular and AngularJS discussion
I tried all morning to fix this.  I was using npm as root so I reinstalled everything as regular user using homebrew. I fixed permission issues and symlinks.  I also fixed my export path.  It should all work now. it seems I get the same error as before on issuing command npm start.  

here is log do you have any other suggestions?  tia

0 info it worked if it ends with ok

1 verbose cli [ '/usr/local/Cellar/node/8.1.3/bin/node',

1 verbose cli   '/usr/local/bin/npm',

1 verbose cli   'start' ]

2 info using n...@5.0.3

3 info using no...@v8.1.3

4 verbose run-script [ 'prestart', 'start', 'poststart' ]

5 info lifecycle angular-q...@1.0.0~prestart: angular-q...@1.0.0

6 verbose lifecycle angular-q...@1.0.0~prestart: unsafe-perm in lifecycle true

7 verbose lifecycle angular-q...@1.0.0~prestart: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/jrough/project/Demo/node_modules/.bin:/usr/local/npm_packages/bin:/usr/local/cellar/bin:/Users/jrough/.npm-packages/bin:/usr/local/git/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

8 verbose lifecycle angular-q...@1.0.0~prestart: CWD: /Users/jrough/project/Demo

9 silly lifecycle angular-q...@1.0.0~prestart: Args: [ '-c', 'npm run build' ]

10 silly lifecycle angular-q...@1.0.0~prestart: Returned: code: 2  signal: null

11 info lifecycle angular-q...@1.0.0~prestart: Failed to exec prestart script

12 verbose stack Error: angular-q...@1.0.0 prestart: `npm run build`

12 verbose stack Exit status 2

12 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)

12 verbose stack     at emitTwo (events.js:125:13)

12 verbose stack     at EventEmitter.emit (events.js:213:7)

12 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)

12 verbose stack     at emitTwo (events.js:125:13)

12 verbose stack     at ChildProcess.emit (events.js:213:7)

12 verbose stack     at maybeClose (internal/child_process.js:897:16)

12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)

13 verbose pkgid angular-q...@1.0.0

14 verbose cwd /Users/jrough/project/Demo


Lucas Lacroix

unread,
Jul 7, 2017, 2:32:07 PM7/7/17
to Angular and AngularJS discussion
Alright... That looks like an error coming back from "tsc".

I think you may be using "-p" incorrectly. According to the doc, that should be the path to a directory containing a tsconfig.json file. Try removing it from your "build" command and try again.

Janis Rough

unread,
Jul 7, 2017, 7:24:40 PM7/7/17
to Angular and AngularJS discussion
hey it worked, I just re-installed the demo file in another directory but my npm seems to be working so much better now.  i was lazy and installed homebrew as root and ever after did npm installs wrong.  thnk,
Reply all
Reply to author
Forward
0 new messages