Я хочу включить библиотеку shelljs в угловую 2 машинописных текста. Я включил файл shelljs.d.ts в мою библиотеку node_modules/shelljs.Невозможно найти модуль «shelljs» с включением lib в угловой 2 машинописных текста
Мой package.json
"name": "myproj1",
"description": "myproj1: A project",
"typings": {
"shelljs": {
"definitions": "node_modules/shelljs/shelljs.d.ts",
"source": "node_modules/shelljs/global.js"
}
},
Мои webpack.config.js
var path = require('path');
module.exports = {
entry: './app/web/boot.ts',
output: {
path: path.resolve(__dirname, "js"),
filename: "bundle.js"
},
resolve: {
extensions:['','.js','.ts']
},
module:{
loaders: [{
test: /\.ts/,
loaders: ['ts-loader'],
exclude: /node_modules/
}]
},
target: 'node'
};
Мои package.json опции компилятора:
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
Мой файл TS:
import child = require("shelljs");
somefun(){
child.exec('node --version',(code, stdout, stderr)=>{
console.log('Exit code:', code);
console.log('Program output:', stdout);
console.log('Program stderr:', stderr);
});
}
Я получаю сообщение об ошибке «Не могу найти модуль« shelljs ». Пожалуйста, помогите мне включить библиотеку в мой проект.
Не знаю, как работает 'shell.js', но попробуйте' let shell = require ('shelljs/global'); shell.exec (... ' – tchelidze