spotify / web-api-examples

Basic examples to authenticate and fetch data using the Spotify Web API
Apache License 2.0
1.98k stars 1.66k forks source link

Error: Cannot find module 'express' #31

Open ithortureu opened 5 years ago

ithortureu commented 5 years ago

When I try to run node app.js, I get the error message:

Error: Cannot find module 'express' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15) at Function.Module._load (internal/modules/cjs/loader.js:506:25) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (C:\Users\MyUsername\Documents\njtest\spotifyapi\web-api-auth-examples-master\web-api-auth-examples-master\authorization_code\app.js:10:15) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3)

Is this on my end or did something happen here?

Sigmus commented 5 years ago

Did you do anpm install first? What's your node version?

gauravbora2008 commented 5 years ago

Issue got resolved at my end by updating node to the latest version.

delberttt commented 4 years ago

Run npm install in the directory with the package.json file.

larvenz commented 4 years ago

I had this problem while going through the tutorial on a Windows 10 machine. It turned out to be the default app for the .js file wasn't Node.js. Change this through the "open with..." dialog and it will execute properly.

NicholasCousar commented 3 years ago

Did you do anpm install first? What's your node version?

When I ran this I got the following warnings, should I be concerned?

npm WARN deprecated request@2.83.0: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated hawk@6.0.2: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. npm WARN deprecated har-validator@5.0.3: this library is no longer supported npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated sntp@2.1.0: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. npm WARN deprecated boom@4.3.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated cryptiles@3.1.4: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated boom@5.2.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN web-api-auth-examples@0.0.2 No repository field. npm WARN web-api-auth-examples@0.0.2 No license field. added 102 packages from 88 contributors and audited 102 packages in 2.236s found 2 vulnerabilities (1 moderate, 1 high) run npm audit fix to fix them, or npm audit for details