質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

Q&A

解決済

1回答

14304閲覧

Node.js エラーで実行できない(internal/modules/cjs/loader.js:638)

Rommy

総合スコア5

Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

1グッド

3クリップ

投稿2019/09/02 21:19

編集2019/09/03 17:12

Node.js エラーで実行できない

Node.jsをWindows10で初めて使う者です。
以下エラーになり実行が出来ません

C:\WINDOWS\system32>node index.js internal/modules/cjs/loader.js:638 throw err; ^ Error: Cannot find module 'C:\WINDOWS\system32\index.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

このサイトに、似た質問がありましたが自分のとは違うみたいで
調べても解決策と思われるのが見つからず質問させて頂きました。
解決策をご存知の方いらっしゃれば教えて頂けると嬉しいです。
よろしくおねがいします

※使用したコード
https://qiita.com/miso_develop/items/bdcf15489b069ba1fa61』

const config = { restApiId: "xxxxxxxx", resourceId: "xxxxxxxx", httpMethod: "ANY", port: 3000, } const execSync = require('child_process').execSync const ngrok = require('ngrok') const main = async () => { const ngrokUrl = await ngrok.connect(config.port) console.log(ngrokUrl) execSync(`aws apigateway put-integration --rest-api-id ${config.restApiId} --resource-id ${config.resourceId} --http-method ${config.httpMethod} --type HTTP_PROXY --integration-http-method ${config.httpMethod} --uri ${ngrokUrl}`) execSync(`aws apigateway create-deployment --rest-api-id ${config.restApiId} --stage-name prod`) console.log(`https://${config.restApiId}.execute-api.ap-northeast-1.amazonaws.com/prod`) } main()

※試したこと(覚えている限り)

npm install -g npm-install-missing
npm install googleapis@39 --save
npm install commander@2.9
DrqYuto👍を押しています

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2019/09/03 00:08

コードを追記して下さい。
sousuke

2019/09/03 02:06

index.jsの中身を見せないとどうすることもできませんよ
Rommy

2019/09/03 17:12

追記しました。 失礼致しました
OkuHiroto

2020/05/19 23:50

index.jsの中身は?
guest

回答1

0

ベストアンサー

たぶん、コマンドを実行しているフォルダにindex.jsがないだけ。
(system32ディレクトリに作ると思えないし)

CDコマンド等でカレントディレクトリをindex.jsのあるところに移動させるか、index.jsのフルパスを指定してください。(DOSコマンドの使い方はググって調べよう)

投稿2019/09/03 02:54

gentaro

総合スコア8949

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Rommy

2019/09/03 17:38

やってみましたが似たエラーが出てきました。 C:\Users\Ross>cd C:\Users\Ross\Downloads C:\Users\Ross\Downloads>node index.js internal/modules/cjs/loader.js:638 throw err; ^ Error: Cannot find module 'ngrok' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (C:\Users\Ross\Downloads\index.js:9:15) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3)
querykuma

2019/09/03 18:37

> Error: Cannot find module 'ngrok' このエラーは npm install ngrok でしょう。
Rommy

2019/09/04 14:51

『Error: Cannot find module 'ngrok'』からは抜け出せたのですが次はこれが出てきました。 An error occurred (NotFoundException) when calling the PutIntegration operation: Invalid Resource identifier specified (node:7936) UnhandledPromiseRejectionWarning: Error: Command failed: aws apigateway put-integration --rest-api-id ko2hqscl10 --resource-id 5d43xut0rk --http-method ANY --type HTTP_PROXY --integration-http-method ANY --uri https://6d127f83.ngrok.io An error occurred (NotFoundException) when calling the PutIntegration operation: Invalid Resource identifier specified at checkExecSyncError (child_process.js:629:11) at execSync (child_process.js:666:13) at main (C:\Users\Ross\Downloads\index.js:15:5) at process._tickCallback (internal/process/next_tick.js:68:7) (node:7936) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:7936) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
gentaro

2019/09/04 15:18 編集

それらは当初のエラーとは全然別要因で、最初の質問内容はnodeコマンドの使い方の問題であり、それ以降のエラーはプログラムの内容に起因するものです。 なので、当初の問題は既に解決済みだと考えています。 ぱっと見た感じではおそらくAWSを利用するためのリソースIDが間違っているとかそういう話ですが、あなたが記事に書かれた通りにちゃんとやっててもエラーが解決しないのであれば、その元記事にコメントして質問してください。(その記事を書いた人が間違いなく適切な答えを持ってるので) ここはQiitaのサポートサイトではないので、ここで質問する以上は自分でやれるだけの手を尽くして調べてから改めて質問をしましょう。 https://teratail.com/help/question-tips
Rommy

2019/09/06 12:24

失礼致しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問