Expressを起動しようとするとエラーが発生します。
https://qiita.com/etet-etet/items/1c65b934dbe7fc33490b
この記事の通りに進めていたところ、npm start
を実行した際にエラーが発生しました。
omujunnoMacBook-Pro:~ omujun$ npm start npm ERR! path /Users/omujun/package.json npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open '/Users/omujun/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! /Users/omujun/.npm/_logs/2018-04-30T09_29_16_398Z-debug.log
宜しくお願い致します。
追記
(karamarimo様の回答について)
package.json を置いているフォルダーで npm start を実行したところ、以下のようなエラーが発生しました。
omujunnoMacBook-Pro:sampleapp omujun$ npm start > sampleapp@0.0.0 start /Users/omujun/sampleapp > node ./bin/www internal/modules/cjs/loader.js:550 throw err; ^ Error: Cannot find module 'http-errors' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15) at Function.Module._load (internal/modules/cjs/loader.js:475:25) at Module.require (internal/modules/cjs/loader.js:598:17) at require (internal/modules/cjs/helpers.js:11:18) at Object.<anonymous> (/Users/omujun/sampleapp/app.js:1:81) at Module._compile (internal/modules/cjs/loader.js:654:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10) at Module.load (internal/modules/cjs/loader.js:566:32) at tryModuleLoad (internal/modules/cjs/loader.js:506:12) at Function.Module._load (internal/modules/cjs/loader.js:498:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sampleapp@0.0.0 start: `node ./bin/www` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the sampleapp@0.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install? npm ERR! A complete log of this run can be found in: npm ERR! /Users/omujun/.npm/_logs/2018-04-30T09_53_53_811Z-debug.log omujunnoMacBook-Pro:sampleapp omujun$
以下はpackage.jsonの中身です
{ "name": "sampleapp", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "cookie-parser": "~1.4.3", "debug": "~2.6.9", "express": "~4.16.0", "http-errors": "~1.6.2", "jade": "~1.11.0", "morgan": "~1.9.0" } }