rddill-IBM / ZeroToBlockchain

Tutorial for Zero to Blockchain series
342 stars 924 forks source link

Error: namespace already exists #15

Closed rolivieri closed 6 years ago

rolivieri commented 6 years ago

Environment: macOS 10.13.2 (17C205), npm : 5.6.0, node: v8.9.4

I am following the video for Chapter04. Executing the npm install command (minute 16.45 in the video) from the ZeroToBlockchain/Chapter04 folder results in the following error:

$ pwd
/Users/olivieri/git/ZeroToBlockchain/Chapter04

$ npm install
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> zerotoblockchain-network@0.1.6 prepublish /Users/olivieri/git/ZeroToBlockchain/Chapter04
> mkdirp ./network/dist && composer archive create --sourceType dir --sourceName . -a ./network/dist/zerotoblockchain-network.bna

Creating Business Network Archive

Looking for package.json of Business Network Definition
    Input directory: /Users/olivieri/git/ZeroToBlockchain/Chapter04
Error: namespace already exists
Command failed

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zerotoblockchain-network@0.1.6 prepublish: `mkdirp ./network/dist && composer archive create --sourceType dir --sourceName . -a ./network/dist/zerotoblockchain-network.bna`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zerotoblockchain-network@0.1.6 prepublish 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/olivieri/.npm/_logs/2018-01-30T17_23_13_638Z-debug.log

Any ideas what I could be doing wrong? Thanks.

PS Just fyi, executing npm install from the Chapter03 folder worked just fine as expected:

$ npm install

...

> protobufjs@6.6.3 postinstall /Users/olivieri/git/ZeroToBlockchain/Chapter03/network/node_modules/protobufjs
> node scripts/postinstall

npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> zerotoblockchain-network@0.1.5 prepublish /Users/olivieri/git/ZeroToBlockchain/Chapter03/network
> mkdirp ./network/dist && composer archive create --sourceType dir --sourceName . -a ./network/dist/zerotoblockchain-network.bna

Creating Business Network Archive

Looking for package.json of Business Network Definition
    Input directory: /Users/olivieri/git/ZeroToBlockchain/Chapter03/network

Found:
    Description: Zero to Blockchain tutorial network
    Name: zerotoblockchain-network
    Identifier: zerotoblockchain-network@0.1.5

Written Business Network Definition Archive file to 
    Output file: ./network/dist/zerotoblockchain-network.bna

Command succeeded

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.

added 1588 packages in 50.893s
rddill-IBM commented 6 years ago

Please see the Readme file for this chapter. The error is to be expected in this chapter. It occurs because the composer build tool searches all folders for *.cto files and, since we have those files in the network folder and also in the answers folder, composer gets confused.

rolivieri commented 6 years ago

@rddill-IBM Thanks for the quick response and pointing me in the right direction! It is working now just fine.