"tns create" gives me a "Error: Command npm failed with exit code 1"


#1

I’m going through the tutorial and every time I try “tns create” I get the same error. “Error: Command npm failed with exit code 1”

I’ve tried:
tns create HelloWorld --template nativescript-template-ng-tutorial
tns create --ng

Also tried it with sudo command.
Worked fine on Windows, but doesn’t work on Mac

Os: Mac El Capitan
Npm Version: 3.10.10
Node Version: 6.10.0
TSC Version: 2.2.1

There a way to get an error log? It looks like it attempts to install something, looks like rxjs from the quick glance but can’t be sure.

Update:

I ran just sudo tns create HelloWorldMac without all the other switches and got the following below. What’s weird is that it creates the folder HelloWorldMac during the install and then when it crashes it deletes the folder. So I can’t get the log file mentioned.

Installing  tns-template-hello-world
/Users/fredmastro/Documents/HelloWorldMac
└─┬ tns-template-hello-world@2.5.0 
  └── nativescript-theme-core@1.0.2 


/Users/fredmastro/Documents/HelloWorldMac
└─┬ tns-core-modules@2.5.1 
  └── tns-core-modules-widgets@2.5.0 



> nativescript-dev-android-snapshot@0.0.6 postinstall /Users/fredmastro/Documents/HelloWorldMac/node_modules/nativescript-dev-android-snapshot
> node postinstall.js

/Users/fredmastro/Documents/HelloWorldMac/node_modules/mkdirp/index.js:90
                    throw err0;
                    ^

Error: EACCES: permission denied, mkdir '/Users/fredmastro/Documents/HelloWorldMac/hooks'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:922:18)
    at sync (/Users/fredmastro/Documents/HelloWorldMac/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/Users/fredmastro/Documents/HelloWorldMac/node_modules/mkdirp/index.js:77:24)
    at /Users/fredmastro/Documents/HelloWorldMac/node_modules/nativescript-hook/index.js:77:11
    at /Users/fredmastro/Documents/HelloWorldMac/node_modules/nativescript-hook/index.js:61:4
    at Array.forEach (native)
    at forEachHook (/Users/fredmastro/Documents/HelloWorldMac/node_modules/nativescript-hook/index.js:60:12)
    at postinstall (/Users/fredmastro/Documents/HelloWorldMac/node_modules/nativescript-hook/index.js:74:2)
    at Object.postinstall (/Users/fredmastro/Documents/HelloWorldMac/node_modules/nativescript-hook/index.js:7:11)
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! nativescript-dev-android-snapshot@0.0.6 postinstall: `node postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nativescript-dev-android-snapshot@0.0.6 postinstall script 'node postinstall.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nativescript-dev-android-snapshot package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node postinstall.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs nativescript-dev-android-snapshot
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls nativescript-dev-android-snapshot
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/fredmastro/Documents/HelloWorldMac/npm-debug.log
Command npm failed with exit code 1
# create

#2

Hello,

It’s an issue due to your permissions.
try sudo chmod -R 755 /Users/fredmastro/Documents and recreate a project to fix it

Edit :
You said you ran sudo tns create HelloWorldMac, you should run this command without sudo.


#3

Thank you. That actually fixed the problem in running a basic tns create MyApp command. However, it still fails when I try tns create MyApp --ng or the original command tns create HelloWorld --template nativescript-template-ng-tutorial

$ tns create HelloWorldMacNg --ng

Output
Installing tns-template-hello-world-ng
Error: Command npm failed with exit code 1
# create

The only thing that appears in the folder is the package.json. It fails on rxjs


#4

try npm -v or npm --version. You should have at least 6.9+
try tns -v or tns --version . You should have 2.5+

the command tns create xxx -ng should alwasy work.

If you want to use the nativescript template tutorial, try cloning the github repo instead.

btw, be sure you have git installed on your computer to avoid any issue.


#5

even if I try just tns create MyApp --ng it doesn’t work.
ok so my versions

npm -v 3.10.10
node -v 6.10.0
tns --versoin 2.5.2
git --version 2.10.1

fails doing something with rxjs

Output
fredmastro$ tns create HelloWorldMacNg --ng
Installing tns-template-hello-world-ng
Error: Command npm failed with exit code 1

Then it spits up the tns help

# create

│ Usage                     │ Synopsis                                                                                                                                                        │
│ Create from default       │ $ tns create <App Name> [--path <Directory>] [--appid <App ID>]                                                                                                 │

etc…


#6

Can you share the full stack trace ? Your versions looks good, can be another permission issue. Also, can you share a tns doctor ?


#7

That’s the problem with this error, it leaves nothing behind. No stacktrace no error log. So i can tns with --log trace which is in the next reply (since I didn’t discover I could do this until after I posted)

tns doctor

Output:

Verifying CocoaPods. This may take more than a minute, please be patient.
nativescript-check-cocoapods@0.0.1 /private/var/folders/8_/fpgnftd93m9d29ljk56w56s00000gn/T/nativescript-check-cocoapods117127-4444-eq1p7y.y5tkv5cdi
└── tns-ios@2.5.0 

npm WARN nativescript-check-cocoapods@0.0.1 No description
npm WARN nativescript-check-cocoapods@0.0.1 No repository field.
npm WARN nativescript-check-cocoapods@0.0.1 No license field.

  ◝ Verifying CocoaPods. This may take some time, please be patient..
Your components are up-to-date.

No issues were detected.

#8

Ok found the --log trace option.

Here’s the out from tns with that turned on. I’m sitll digesting what it says.

Output

   Freds-MacBook-Pro:Documents fredmastro$ tns create HelloWorldMacNg --ng --log trace
execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
spawn: /usr/local/opt/android-sdk/platform-tools/adb "--help"
Socket {
  connecting: false,
  _hadError: false,
  _handle: 
   Pipe {
     bytesRead: 0,
     _externalStream: {},
     fd: 15,
     writeQueueSize: 0,
     owner: [Circular],
     onread: [Function: onread],
     reading: true },
  _parent: null,
  _host: null,
  _readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: BufferList { head: null, tail: null, length: 0 },
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: true,
     sync: false,
     needReadable: true,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events: 
   { end: { [Function: g] listener: [Function: onend] },
     finish: [Function: onSocketFinish],
     _socketEnd: [Function: onSocketEnd],
     close: [Function] },
  _eventsCount: 4,
  _maxListeners: undefined,
  _writableState: 
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     decodeStrings: false,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree: CorkedRequest { next: null, entry: null, finish: [Function] } },
  writable: false,
  allowHalfOpen: false,
  destroyed: false,
  _bytesDispatched: 0,
  _sockname: null,
  _writev: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: null,
  _server: null }
Exec uname -a 
 stdout: Darwin Freds-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan  9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64
 
 stderr: 
Exec npm -v 
 stdout: 3.10.10
 
 stderr: 
spawn: java "-version"
Exec node-gyp -v 
 stdout:  
 stderr: /bin/sh: node-gyp: command not found

Exec xcodebuild -version 
 stdout: Xcode 8.2.1
Build version 8C1002
 
 stderr: 
Exec gem which xcodeproj 
 stdout: /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.4.2/lib/xcodeproj.rb
 
 stderr: 
Exec pod --version 
 stdout: 1.2.0
 
 stderr: 
Exec '/usr/local/opt/android-sdk/platform-tools/adb' version 
 stdout: Android Debug Bridge version 1.0.36
Revision 0e9850346394-android
 
 stderr: 
spawn: /usr/local/opt/android-sdk/tools/android "-h"
Result when throw error is false:
{ stdout: '\n       Usage:\n       android [global options] action [action options]\n       Global options:\n  -s --silent     : Silent mode, shows errors only.\n  -v --verbose    : Verbose mode, shows errors, warnings and all messages.\n     --clear-cache: Clear the SDK Manager repository manifest cache.\n  -h --help       : Help on a specific command.\n\n                                                                    Valid\n                                                                    actions\n                                                                    are\n                                                                    composed\n                                                                    of a verb\n                                                                    and an\n                                                                    optional\n                                                                    direct\n                                                                    object:\n-    sdk              : Displays the SDK Manager window.\n-    avd              : Displays the AVD Manager window.\n-   list              : Lists existing targets or virtual devices.\n-   list avd          : Lists existing Android Virtual Devices.\n-   list target       : Lists existing targets.\n-   list device       : Lists existing devices.\n-   list sdk          : Lists remote SDK repository.\n- create avd          : Creates a new Android Virtual Device.\n-   move avd          : Moves or renames an Android Virtual Device.\n- delete avd          : Deletes an Android Virtual Device.\n- update avd          : Updates an Android Virtual Device to match the folders\n                        of a new SDK.\n- create project      : Creates a new Android project.\n- update project      : Updates an Android project (must already have an\n                        AndroidManifest.xml).\n- create test-project : Creates a new Android project for a test package.\n- update test-project : Updates the Android project for a test package (must\n                        already have an AndroidManifest.xml).\n- create lib-project  : Creates a new Android library project.\n- update lib-project  : Updates an Android library project (must already have\n                        an AndroidManifest.xml).\n- create uitest-project: Creates a new UI test project.\n- update adb          : Updates adb to support the USB devices declared in the\n                        SDK add-ons.\n- update sdk          : Updates the SDK by suggesting new platforms to install\n                        if available.\n',
  stderr: '',
  exitCode: 1 }
Exec mono --version 
 stdout: Mono JIT compiler version 4.4.0 (mono-4.4.0-branch-c7-baseline/5995f74 Thu Jun  2 15:13:10 EDT 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.6.0svn-mono-master/a173357)
	GC:            sgen
 
 stderr: 
Exec git --version 
 stdout: git version 2.10.1 (Apple Git-78)
 
 stderr: 
Exec gradle -v 
 stdout:  
 stderr: /bin/sh: gradle: command not found

Exec "/Library/Java/Home/bin/javac" -version 
 stdout:  
 stderr: javac 1.8.0_121

System information:
{ procInfo: 'nativescript/2.5.2',
  platform: 'darwin',
  os: 'Darwin Freds-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan  9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v6.10.0',
  npmVer: '3.10.10',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 8.2.1\nBuild version 8C1002\n',
  xcodeprojGemLocation: '/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.4.2/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: '1.2.0',
  adbVer: 'Android Debug Bridge version 1.0.36',
  androidInstalled: true,
  monoVer: '4.4.0',
  gitVer: '2.10.1 (Apple Git-78)',
  gradleVer: null,
  javacVersion: '1.8.0_121' }
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'create'.
AnalyticsInstallationID: 8aa4b39a-af58-4b78-9dcf-bef7f18c4ff5
monitor not started
monitor not started
monitor not started
monitor has started, connecting to http://5752dabccfc54c4ab82aea9626b7338e.monitor-eqatec.com/json.ashx
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'NodeJSVersion' with value '6_10_0'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Statistics was sent successfully (xhr).
Creating a new NativeScript project with name HelloWorldMacNg and id org.nativescript.HelloWorldMacNg at location /Users/fredmastro/Documents/HelloWorldMacNg
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'Template used for project creation' with value 'tns-template-hello-world-ng'.
Waiting for analytics to send information. Will check in a 1000ms.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Statistics was sent successfully (xhr).
Using NativeScript verified template: tns-template-hello-world-ng with version undefined.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Exec npm view tns-template-hello-world-ng --json  dist-tags 
 stdout: {
  "latest": "2.5.0"
}
 
 stderr: 
Using version 2.5.0. 
Exec npm view tns-template-hello-world-ng --json  versions 
 stdout: [
  "1.6.1",
  "1.6.2",
  "1.7.0",
  "1.7.1",
  "1.7.2",
  "1.7.3",
  "2.0.0",
  "2.0.1",
  "2.0.3",
  "2.1.0",
  "2.1.1",
  "2.1.2",
  "2.2.0",
  "2.2.1",
  "2.2.2",
  "2.2.3",
  "2.3.0",
  "2.3.1",
  "2.3.2",
  "2.3.3",
  "2.3.4",
  "2.4.0",
  "2.4.1",
  "2.4.2",
  "2.4.3",
  "2.4.4",
  "2.4.5",
  "2.5.0"
]
 
 stderr: 
Installing  tns-template-hello-world-ng
spawn: npm "install" "tns-template-hello-world-ng@2.5.0" "--silent" "--save"
Error: Command npm failed with exit code 1
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:566:15)
    at error (/usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:43:96)
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/services/project-templates-service.js:24:106
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at err (/usr/local/lib/node_modules/nativescript/lib/services/project-service.js:58:112)
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    - - - - -
    at ChildProcess.childProcess.on (/usr/local/lib/node_modules/nativescript/lib/common/child-process.js:89:38)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: Error: Command npm failed with exit code 1
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:566:15)
    at ex (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:120:33)
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/services/commands-service.js:80:104
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/dispatchers.js:37:84
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    - - - - -
    at error (/usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:47:23)
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/services/project-templates-service.js:24:106
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at err (/usr/local/lib/node_modules/nativescript/lib/services/project-service.js:58:112)
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/commands/create-project.js:27:75
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'help'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, clean-app, clean-app|android, clean-app|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, devices, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, help, info, init, install, livesync, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|find, plugin|install, plugin|remove, plugin|search, plugin|update, post-install-cli, prepare, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, update, usage-reporting
Reading help for command 'create'. FileName is 'create.md'.
# create

┌───────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Usage                     │ Synopsis                                                                                                                                                        │
│ Create from default       │ $ tns create <App Name> [--path <Directory>] [--appid <App ID>]                                                                                                 │
│ JavaScript template       │                                                                                                                                                                 │
│ Create from default       │ $ tns create <App Name> --template typescript [--path <Directory>] [--appid <App ID>] OR $ tns create <App Name> --tsc [--path <Directory>] [--appid <App ID>] │
│ TypeScript template       │ [39m OR $ tns create <App Name> --template tsc [--path <Directory>] [--appid <App ID>]                                                                          │
│ Create from default       │ $ tns create <App Name> --template angular [--path <Directory>] [--appid <App ID>] OR $ tns create <App Name> --template ng [--path <Directory>] [--appid <App  │
│ Angular template          │ ID>] OR $ tns create <App Name> --ng [--path <Directory>] [--appid <App ID>]                                                                                    │
│ Copy from existing        │ $ tns create <App Name> [--path <Directory>] [--appid <App ID>] --copy-from <Directory>                                                                         │
│ project                   │                                                                                                                                                                 │
│ Create from custom        │ $ tns create <App Name> [--path <Directory>] [--appid <App ID>] --template <Template>                                                                           │
│ template                  │                                                                                                                                                                 │
└───────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Creates a new project for native development with NativeScript.

### Options

    * --path - Specifies the directory where you want to create the project, if different from the current directory. The directory must be empty.
    * --appid - Sets the application identifier for your project.
    * --copy-from - Specifies a directory which contains an existing NativeScript project. If --copy-from and --template are not set, the NativeScript CLI creates the project from the default JavaScript hello-world template.
    * --template - Specifies a valid npm package which you want to use to create your project. If --copy-from and --template are not set, the NativeScript CLI creates the project from the default JavaScript hello-world template.
    * --ng - Sets the template for your project to the Angular template.
    * --tsc - Sets the template for your project to the TypeScript template.

### Attributes

    * <App Name> is the name of project. The specified name must meet the requirements of all platforms that you want to target. For more information about the <App Name> requirements, run $ tns help create
    * <App ID> is the application identifier for your project. It must be a domain name in reverse and must meet the requirements of all platforms that you want to target. If not specified, the application identifier is set to org.nativescript.<App name> For more information about the <App ID> requirements, run $ tns help create

Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track exception with message 'Error: Command npm failed with exit code 1'.
Waiting for analytics to send information. Will check in a 1000ms.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000

Freds-MacBook-Pro:Documents fredmastro$

Update:

Getting closer I think. I noticed in the stack it tired to run
spawn: npm “install” “tns-template-hello-world-ng@2.5.0” “–silent” "–save"
Error: Command npm failed with exit code 1

so I ran npm “install” “tns-template-hello-world-ng@2.5.0” and got an npm log file which errored out with this below. Not sure if that’s cause I’m running the command out of contex though.

495 verbose stack Error: Invalid name: "@angular/platform-browser-dynamic"
495 verbose stack     at ensureValidName (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:300:15)
495 verbose stack     at Object.fixNameField (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:204:5)
495 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:30:38
495 verbose stack     at Array.forEach (native)
495 verbose stack     at normalize (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:29:15)
495 verbose stack     at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:349:5)
495 verbose stack     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:5)
495 verbose stack     at ReadFileContext.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:295:20)
495 verbose stack     at ReadFileContext.callback (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16)
495 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)

#9

Fixed it!!!

Wow, sheesh. Ok so after drilling down running tns --log trace and finding that npm command, which I then ran manually and got the Error: Invalid name. I found a solution on StackTrace here: http://stackoverflow.com/questions/37038269/npm-err-invalid-name-angular-core-when-following-the-angular-2-quick-start

Basically, I can npm -g install npm to get version 4.3.0 and it worked!

The whole thing is misleading because Error Code 1 from npm is so generic.

So there’s a few fixes, thanks to Eric for helping me track this down.

  1. Make sure you have proper permissions on folder
  2. run tns with --log trace
  3. Find where it errors out. If it’s npm, run the command without the --silent option to get the real error message
  4. Google that error message.