Hello Test: npm install fail, cannot find module 'tape'

I renamed cc_tuts to tutorial, but other than that, the test/index.js file is identical to this

Here what the console is showing. The previous tutorial, Hello Holo is complete, and the curl command works


[nix-shell:/vagrant/holochain/tutorial]$ hc test
Packaging files for testing to file: "/vagrant/holochain/tutorial/dist/tutorial.dna.json"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR "
/home/vagrant/target
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR"
    Finished release [optimized] target(s) in 0.41s
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
(no output file specified, not emitting output)
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm2wat $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm2wat $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wat2wasm $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wat2wasm $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR "
/home/vagrant/target
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR"
    Finished release [optimized] target(s) in 0.38s
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
(no output file specified, not emitting output)
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm2wat $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm2wat $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wat2wasm $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wat2wasm $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
Created DNA package file at "/vagrant/holochain/tutorial/dist/tutorial.dna.json"
DNA hash: QmWDbxug7rQG3mbxWfAfocw1q2NiPTH2qAvB6WqeWTQdnZ
Installing node_modules
> npm install --silent
"npm install --silent"
Error: command npm install --silent was not successful

[nix-shell:/vagrant/holochain/tutorial]$ hc test
Packaging files for testing to file: "/vagrant/holochain/tutorial/dist/tutorial.dna.json"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR "
/home/vagrant/target
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR"
    Finished release [optimized] target(s) in 0.38s
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
(no output file specified, not emitting output)
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm2wat $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm2wat $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wat2wasm $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wat2wasm $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR "
/home/vagrant/target
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR"
    Finished release [optimized] target(s) in 0.37s
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-opt -Oz --vacuum $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
(no output file specified, not emitting output)
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm2wat $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm2wat $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wat2wasm $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wat2wasm $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wat -o $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/hello.wasm"
Created DNA package file at "/vagrant/holochain/tutorial/dist/tutorial.dna.json"
DNA hash: QmWDbxug7rQG3mbxWfAfocw1q2NiPTH2qAvB6WqeWTQdnZ
Running tests in test/index.js
> node test/index.js
"node test/index.js"
internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module 'tape'
Require stack:
- /vagrant/holochain/tutorial/test/node_modules/@holochain/tryorama/lib/orchestrator.js
- /vagrant/holochain/tutorial/test/node_modules/@holochain/tryorama/lib/index.js
- /vagrant/holochain/tutorial/test/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/vagrant/holochain/tutorial/test/node_modules/@holochain/tryorama/lib/orchestrator.js:19:23)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/vagrant/holochain/tutorial/test/node_modules/@holochain/tryorama/lib/orchestrator.js',
    '/vagrant/holochain/tutorial/test/node_modules/@holochain/tryorama/lib/index.js',
    '/vagrant/holochain/tutorial/test/index.js'
  ]
}
Error: command node test/index.js was not successful

Hi @bradwbradw,

It seems like the npm install inside the test folder did not succeed, so now you don’t have the tape dependency in your node_modules and hc test can’t find it. Can you delete the node_modules folder and the package-lock.json file and run npm install directly inside the test folder, to see the exact error you are getting from that?

1 Like

Should i be in nix-shell or no?

I’ll try this later tonight. Thanks for the reply!

1 Like

@bradwbradw it’ll be easier if you are in nix-shell, because you’re guaranteed to have npm and the right version of node installed when you run npm install. Good luck!

Hi,
i got the same problem than @bradwbradw.
I try the npm install in the test directory as you said and below is the error i obtained.

Thks for the help!

[nix-shell:/vagrant/holochain/coreconcepts/cc_tuts/test]$ npm install

npm WARN deprecated sprintf@0.1.5: The sprintf package is deprecated in favor of sprintf-js.
npm WARN deprecated @holochain/hachiko@0.5.1: this version was released improperly
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN test No description
npm WARN test No repository field.
npm WARN test No license field.

npm ERR! code EPROTO
npm ERR! syscall symlink
npm ERR! path …/dotignore/bin/ignored
npm ERR! dest /vagrant/holochain/coreconcepts/cc_tuts/test/node_modules/.bin/ignored
npm ERR! errno -71
npm ERR! EPROTO: protocol error, symlink ‘…/dotignore/bin/ignored’ -> ‘/vagrant/holochain/coreconcepts/cc_tuts/test/node_modules/.bin/ignored’

npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2020-01-26T18_42_49_688Z-debug.log

[nix-shell:/vagrant/holochain/coreconcepts/cc_tuts/test]$

@elrihaz thanks for that debugging output; looks like you’re using Windows. (@bradwbradw are you using Windows too?)

Here’s a suggested fix from some other project that uses Vagrant for Windows devs. Basically what’s happening is that your core concepts folder is on the Windows host, not inside the Linux VM, and NTFS doesn’t support symlinks, which apparently NPM uses.

For brevity, the solution (run all these commands in the tests folder) is:

  1. Remove the not-quite-installed modules: rm -rf node_modules
  2. Re-install, but make copies rather than symlinks: npm install --no-bin-links

Another option is to create the tutorial projects in the Linux VM’s filesystem, rather than the host filesystem.

I really hope this is going to go away once WSL2 is in wide release and Nix have fixed their bugs related to running in WSL. At that point you shouldn’t need to involve Vagrant at all!

Let me know if that works for you!

1 Like

Hi @pauldaoust,

effectively i’m using Windows, sorry i should precise this…
And thank you: removing node_modules and re-installing it by copies works for me!

Yes i hope WSL2 will help but tomorrow i mount a Linux machine to work in good condition! No need to add difficulties with VM.
Holochain deserve all my energy! :slight_smile:

Thanks again for your help and all you do for the project and the community! :clap:

1 Like

Thanks @pauldaoust! Yes i was on windows