🤍 전 강의 25% 할인 중 🤍

2024년 상반기를 돌아보고 하반기에도 함께 성장해요!
인프런이 준비한 25% 할인 받으러 가기 >>

  • 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

npm start 시 오류가 납니다.

22.02.16 23:00 작성 조회수 4.38k

0

root@ip-172-31-43-165:/home/ubuntu/react_nodebird/back# npm start

 

> react-nodebird-back@1.0.0 start /home/ubuntu/react_nodebird/back

> node app

 

internal/modules/cjs/loader.js:905

  throw err;

  ^

 

Error: Cannot find module './dialects/mysql/data-types'

Require stack:

- /home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/lib/data-types.js

- /home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/lib/utils.js

- /home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/lib/sequelize.js

- /home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/index.js

- /home/ubuntu/react_nodebird/back/models/index.js

- /home/ubuntu/react_nodebird/back/routes/post.js

- /home/ubuntu/react_nodebird/back/app.js

    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)

    at Function.Module._load (internal/modules/cjs/loader.js:746:27)

    at Module.require (internal/modules/cjs/loader.js:974:19)

    at require (internal/modules/cjs/helpers.js:101:18)

    at Object.<anonymous> (/home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/lib/data-types.js:648:20)

    at Module._compile (internal/modules/cjs/loader.js:1085:14)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)

    at Module.load (internal/modules/cjs/loader.js:950:32)

    at Function.Module._load (internal/modules/cjs/loader.js:790:12)

    at Module.require (internal/modules/cjs/loader.js:974:19) {

  code: 'MODULE_NOT_FOUND',

  requireStack: [

    '/home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/lib/data-types.js',

    '/home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/lib/utils.js',

    '/home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/lib/sequelize.js',

    '/home/ubuntu/react_nodebird/back/node_modules/sequelize/dist/index.js',

    '/home/ubuntu/react_nodebird/back/models/index.js',

    '/home/ubuntu/react_nodebird/back/routes/post.js',

    '/home/ubuntu/react_nodebird/back/app.js'

  ]

}

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! react-nodebird-back@1.0.0 start: `node app`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the react-nodebird-back@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2022-02-16T13_55_05_438Z-debug.log

 

--------------------------

데이터타입을 못 찾는다길래 models  파일들 상단에 있는

const DataTypes = require("sequelize");

이 부분이 잘못 됐나 해서

시퀄라이즈랑 시퀄라이즈-cli도 다시 설치했는데

안돼서 다른 문제인 듯 싶은데 도저히 모르겠네요ㅠㅠ

답변 1

답변을 작성해보세요.

0

rm -rf node_modules package-lock.json

으로 통째로 다 지우고

npm i 다시 해보세요.

huhu님의 프로필

huhu

질문자

2022.02.17

ubuntu@ip-172-31-43-165:~/react_nodebird/back$ rm -rf node_modules package-lock.json

ubuntu@ip-172-31-43-165:~/react_nodebird/back$ npm i

npm ERR! code EINVALIDTYPE

npm ERR! typeerror Error: Argument #2: Expected string but got null

npm ERR! typeerror     at exports.findRequirement (/usr/lib/node_modules/npm/lib/install/deps.js:756:3)

npm ERR! typeerror     at findChild (/usr/lib/node_modules/npm/lib/install/deps.js:125:17)

npm ERR! typeerror     at computeMetadata (/usr/lib/node_modules/npm/lib/install/deps.js:135:9)

npm ERR! typeerror     at Installer.normalizeCurrentTree (/usr/lib/node_modules/npm/lib/install.js:414:3)        

npm ERR! typeerror     at Array.<anonymous> (/usr/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)

npm ERR! typeerror     at LOOP (/usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)

npm ERR! typeerror     at /usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7

npm ERR! typeerror     at /usr/lib/node_modules/npm/lib/install.js:368:5

npm ERR! typeerror     at /usr/lib/node_modules/npm/node_modules/iferr/iferr.js:3:64

npm ERR! typeerror     at asyncMap (/usr/lib/node_modules/npm/node_modules/slide/lib/async-map.js:27:18)

npm ERR! typeerror     at exports.getAllMetadata (/usr/lib/node_modules/npm/lib/install/deps.js:228:3)

npm ERR! typeerror     at Installer.loadArgMetadata (/usr/lib/node_modules/npm/lib/install.js:366:3)

npm ERR! typeerror     at /usr/lib/node_modules/npm/lib/install.js:704:16

npm ERR! typeerror     at /usr/lib/node_modules/npm/lib/install/read-shrinkwrap.js:33:16

npm ERR! typeerror     at tryCatcher (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)

npm ERR! typeerror     at Promise._settlePromiseFromHandler (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:517:31)

npm ERR! typeerror This is an error with npm itself. Please report this error at:

npm ERR! typeerror     <https://npm.community>

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /home/ubuntu/.npm/_logs/2022-02-17T05_22_16_333Z-debug.log

 

npm i 하니까 오류 나네요ㅠㅠㅠ...

뭔가 좀 많이 꼬인 것 같은데요. 프로젝트를 새로 clone 하셔야할 수도 있습니다.

huhu님의 프로필

huhu

질문자

2022.02.17

어떤 식으로 하면 될까요?

싹 지우고 다시 git clone 받아서 설치하는 거죠

package.json 한 번 보여주세요. sequelize랑 sequelize-cli가 버전이 일치하지 않는 것 같기도 합니다.

huhu님의 프로필

huhu

질문자

2022.02.17

다 삭제하고 다시 클론해서 설치하니 저 문제는 사라졌습니다!

그러나 다른 문제가 발생했습니다...

 

root@ip-172-31-43-165:/home/ubuntu/react_nodebird/back# npm i

 

> bcrypt@5.0.1 install /home/ubuntu/react_nodebird/back/node_modules/bcrypt

> node-pre-gyp install --fallback-to-build

 

node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@14.19.0 (node-v83 ABI, glibc) (falling back to source compile with node-gyp) 

node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/home/ubuntu/react_nodebird/back/node_modules/bcrypt/lib'

gyp WARN EACCES current user ("ubuntu") does not have permission to access the dev dir "/root/.cache/node-gyp/14.19.0"

gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/ubuntu/react_nodebird/back/node_modules/bcrypt/.node-gyp"gyp WARN install got an error, rolling back install

gyp WARN install got an error, rolling back install

gyp ERR! configure error

gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/ubuntu/react_nodebird/back/node_modules/bcrypt/.node-gyp'

gyp ERR! System Linux 5.4.0-1060-aws

gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/ubuntu/react_nodebird/back/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/ubuntu/react_nodebird/back/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"

gyp ERR! cwd /home/ubuntu/react_nodebird/back/node_modules/bcrypt

gyp ERR! node -v v14.19.0

gyp ERR! node-gyp -v v5.1.0

gyp ERR! not ok

node-pre-gyp ERR! build error

node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js 

configure --fallback-to-build --module=/home/ubuntu/react_nodebird/back/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node 

--module_name=bcrypt_lib --module_path=/home/ubuntu/react_nodebird/back/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)

node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/ubuntu/react_nodebird/back/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)

node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:400:28)

node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1058:16)

node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)

node-pre-gyp ERR! System Linux 5.4.0-1060-aws

node-pre-gyp ERR! command "/usr/bin/node" "/home/ubuntu/react_nodebird/back/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"

node-pre-gyp ERR! cwd /home/ubuntu/react_nodebird/back/node_modules/bcrypt

node-pre-gyp ERR! node -v v14.19.0

node-pre-gyp ERR! node-pre-gyp -v v1.0.8

node-pre-gyp ERR! not ok

Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/ubuntu/react_nodebird/back/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/ubuntu/react_nodebird/back/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)

npm WARN react-nodebird-back@1.0.0 No description

npm WARN react-nodebird-back@1.0.0 No repository field.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

 

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! bcrypt@5.0.1 install: `node-pre-gyp install --fallback-to-build`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the bcrypt@5.0.1 install script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2022-02-17T06_50_09_648Z-debug.log

sudo npm i 하세요.

huhu님의 프로필

huhu

질문자

2022.02.17

와 감사합니다ㅠㅠㅠ

채널톡 아이콘