我有一个代码库,它在节点v10.16.3的Windows机器上运行得非常好,但当我尝试在节点v.12.16.3的CentOS Linux机器上安装相同的代码库时,我得到了以下错误。不确定问题可能是什么。
# npm start
> nest start
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module '@angular-devkit/core'
Require stack:
- /usr/local/lib/node_modules/@nestjs/cli/lib/schematics/schematic.option.js
- /usr/local/lib/node_modules/@nestjs/cli/lib/schematics/index.js
- /usr/local/lib/node_modules/@nestjs/cli/actions/generate.action.js
- /usr/local/lib/node_modules/@nestjs/cli/actions/index.js
- /usr/local/lib/node_modules/@nestjs/cli/commands/command.loader.js
- /usr/local/lib/node_modules/@nestjs/cli/commands/index.js
- /usr/local/lib/node_modules/@nestjs/cli/bin/nest.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous>
(/usr/local/lib/node_modules/@nestjs/cli/lib/schematics/schematic.option.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/local/lib/node_modules/@nestjs/cli/lib/schematics/schematic.option.js',
'/usr/local/lib/node_modules/@nestjs/cli/lib/schematics/index.js',
'/usr/local/lib/node_modules/@nestjs/cli/actions/generate.action.js',
'/usr/local/lib/node_modules/@nestjs/cli/actions/index.js',
'/usr/local/lib/node_modules/@nestjs/cli/commands/command.loader.js',
'/usr/local/lib/node_modules/@nestjs/cli/commands/index.js',
'/usr/local/lib/node_modules/@nestjs/cli/bin/nest.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Exit status 1
npm ERR!
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/2020-05-22T14_14_24_709Z-debug.log
3条答案
按热度按时间sauutmhj1#
删除dist文件夹,然后再次运行
yarn start
、npm start
、yarn start:dev
或npm run start:dev
以重建dist文件夹。此外,yarn prebuild
或npm run prebuild
使用rimraf
执行相同的操作如果您更改了名称,而
tsc
在dist和transpiled.js
文件中未更改该名称,则会出现此问题,因此无法找到模块我认为就我所知,nestjs或tsc这样做是为了使蒸发更快
3htmauhk2#
没有其他工作对我来说,但以下:
我不完全确定是否有任何负面影响,虽然
oknwwptz3#
最重要的是,在您启动node js的地方,dist/或/ build文件夹有一个错误的路径,我们导入了该路径,或者NPM需要该路径:npm安装--save-dev webpack和Yarn添加webpack这一个packeg将解决您的问题