Build a shopify app with node and react sample app error

Solved
Highlighted
Excursionist
11 1 0

I'm new to shopify, relatively new to node etc.

I'm trying to follow the tutorial - Build a shopify app with node and react https://developers.shopify.com/tutorials/build-a-shopify-app-with-node-and-react/embed-your-app-in-s...

I've downloaded the files after this step and I'm getting the following error:

Error: Cannot find module '@shopify/network'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/louise/shopify-demo-app/node_modules/@shopify/koa-shopify-auth/dist/verify-request/verify-request.js:4:17)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

0 Likes
Highlighted
New Member
1 0 1

I'm facing the same issue.

1 Like
Highlighted
Shopify Staff
Shopify Staff
39 7 8

Can you run `npm install` again? the `@shopify/network` package is a dependency of the `koa-auth` package, it should be installed with that. The package recently was updated, so you may need to delete your node modules if you're still having issues. 

0 Likes
Highlighted
Excursionist
11 1 0

Hi Katie,

I only installed everything today.  I'm using Ubuntu 18.04.3 LTS

My node version is: v12.8.0

My npm version is: 6.10.2

When I installed npm it creates the koa-shopify-auth folder and subfolders within the @shopify folder in node_modules

When I installed npm I got the following warnings but no errors:

npm WARN roody@1.0.0 No description
npm WARN roody@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 9524 packages in 8.101s
found 0 vulnerabilities

 

and when I install koa etc I get the following

npm WARN roody@1.0.0 No description
npm WARN roody@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Full debug log when I npm run dev

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm@6.10.2
3 info using node@v12.8.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle roody@1.0.0~predev: roody@1.0.0
6 info lifecycle roody@1.0.0~dev: roody@1.0.0
7 verbose lifecycle roody@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle roody@1.0.0~dev: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/roody/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle roody@1.0.0~dev: CWD: /roody
10 silly lifecycle roody@1.0.0~dev: Args: [ '-c', 'node server.js' ]
11 silly lifecycle roody@1.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle roody@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: roody@1.0.0 dev: `node server.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
13 verbose stack at EventEmitter.emit (events.js:203:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:203:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid roody@1.0.0
15 verbose cwd /roody
16 verbose Linux 4.15.0-20-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
18 verbose node v12.8.0
19 verbose npm v6.10.2
20 error code ELIFECYCLE
21 error errno 1
22 error roody@1.0.0 dev: `node server.js`
22 error Exit status 1
23 error Failed at the roody@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

0 Likes
Highlighted
New Member
1 0 0

Im seeing the same issue today. This did not seem like a problem a few days ago

0 Likes
Highlighted
New Member
2 0 0

Having the same issue. Happened today.
Just update the new version for the App. So sad = (

I fixed it with add @shopify/network to package.json. If there is other solution, I would like to know~

0 Likes
Highlighted
Shopify Staff
Shopify Staff
39 7 8

Hi all. The package has been updated to list the missing dependency. If you upgrade the package you should be fine now! Thanks for finding this bug :)

1 Like
Highlighted
Excursionist
11 1 0

Hi Katie, I wasn't entirely sure what you meant by update package but I ran this code again and it is working now.

npm install --save koa @shopify/koa-shopify-auth dotenv koa-session isomorphic-fetch
0 Likes
Highlighted
Shopify Staff
Shopify Staff
39 7 8

This is an accepted solution.

Oh sorry about that!

You can update any npm package like this:

npm update <package-name>

So in this case it would be:

npm update @shopify/koa-shopify-auth

That will update a package to its latest version. Install works too. 

1 Like
Highlighted
Excursionist
11 1 0

Sorry, I just didn't know what package you were referring to - Thanks for this!

0 Likes