Sakuya_wd
@Sakuya_wd (霧崎さくや)

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

npm run error internal/modules/cjs/loader.js:に関して

問題

node_modulesを含んだファイルを別ディレクトリにコピーした際に、
npm runをすると下記のエラーがでます。

xxx:src xxx$ npm run test

> fizzbuzz_tester@1.0.0 test /Users/xxx/Jest/FizzBuzz
> jest

internal/modules/cjs/loader.js:1088
  throw err;
  ^

Error: Cannot find module 'jest-cli/bin/jest'
Require stack:
- /Users/xxx/Jest/FizzBuzz/node_modules/.bin/jest
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1085:15)
    at Function.Module._load (internal/modules/cjs/loader.js:928:27)
    at Module.require (internal/modules/cjs/loader.js:1145:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (/Users/xxx/Jest/FizzBuzz/node_modules/.bin/jest:12:3)
    at Module._compile (internal/modules/cjs/loader.js:1256:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
    at Module.load (internal/modules/cjs/loader.js:1105:32)
    at Function.Module._load (internal/modules/cjs/loader.js:967:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/xxx/Jest/FizzBuzz/node_modules/.bin/jest' ]

node_modulesを削除後にnpm initと npm install -D jestをしてからnpm runで
errorが解決されますがnode_modulesを消さないと何故errorが起こるのでしょうか?

2

No Answers yet.

Your answer might help someone💌