After successfully compiling my project, I encountered errors when trying to run npm install
and then webpack
in a new directory. The errors are as follows:
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(500,12): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(502,12): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(504,15): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(505,15): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(506,15): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(1002,23): error TS1005: ',' expected.
In addition to the above errors, there were around 25 other errors in the same file and some other issues in my source files.
I have excluded node_modules
in my tsconfig.json
, and I've also set webpack externals
for packaging node_modules
with a node express backend as shown below:
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function (mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
I'm perplexed as to why everything functions perfectly in my development directory but fails when transferred to another directory.