Error: Cannot find module '@angular/compiler'?
See original GitHub issueBug
[ x] Bug Report
[ ] Feature Request
Description
bug:
I am using an angular4 and “ng-packagr”: “^1.5.0”. if i try to create package it throws following error
node ngoverride.js
module.js:549 throw err; ^
Error: Cannot find module ‘@angular/compiler’ at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at D:\workspace\components\ej2-grid-components\node_modules@angular\compiler-cli\index.js:20:22 at Object.defineProperty.value (D:\workspace\components\ej2-grid-components\node_modules@angular\compiler-cli\index.js:3:17) at Object.<anonymous> (D:\workspace\components\ej2-grid-components\node_modules@angular\compiler-cli\index.js:9:3) at Module._compile (module.js:652:30) at Object.Module._extensions…js (module.js:663:10) at Module.load (module.js:565:32)
If i use angular version 7 and ng-packagr version 4.4.5, it works fine and creating esm15 and fesm15 strucured packages also
My configure file
ngoverride.js
`const ngPackage = require(‘ng-packagr’);
ngPackage .ngPackagr() .forProject(‘ng-package.js’) .withTsConfig(‘tsconfig.lib.json’) .build() .catch(error => { console.error(error); process.exit(1); });`
my ackage.json file
package.json
"scripts": { "check": "node ngoverride.js", "packagr": "ng-packagr -p ng-package.json" }
How To Reproduce
Run folloeing commands
npm i
npm run check
error occurs in console
Expected Behaviour
It has to create esm15 and fesm15 structure but it throws error.
if i run like below
creating ng-package.json
{ "$schema": "./node_modules/ng-packagr/ng-package.schema.json", "lib": { "entryFile": "./public_api.ts" }, "whitelistedNonPeerDependencies": [ "syncfusion", "typedoc", "angular" ] }
package.json ` “scripts”: { “check”: “node ngoverride.js”,
"packagr": "ng-packagr -p ng-package.json"
}
`
then run following commands, it create package but package does not contain esm15 and fesm15 structures
npm i
npm run packagr
Version Information
working fine and creating esm15 and fesm15 structure
$ node_modules/.bin/ng-packagr --version
ng-packagr: "4.4.5"
@angular/*: "*"
typescript: 3.1.6
node: "8.11.3"
npm/: 5.6.0
not working and do not creating esm15 and fesm15 structure
$ node_modules/.bin/ng-packagr --version
ng-packagr: **less than V1.6.0**
"@angular/common": "2.2.1 - 4.10.0",
"@angular/compiler": "^4.4.7",
"@angular/compiler-cli": "2.2.1 - 4.10.0",
"@angular/core": "2.2.1 - 4.10.0",
"@angular/forms": "2.2.1 - 4.10.0",
"@angular/http": "2.2.1 - 4.10.0",
"@angular/platform-browser": "2.2.1 - 4.10.0",
"@angular/platform-browser-dynamic": "2.2.1 - 4.10.0",
"@angular/platform-server": "2.2.1 - 4.10.0",
"@angular/router": "2.2.1 - 4.10.0",
"@schematics/angular": "0.7.2",
typescript: 2.7.2
node: "8.11.3"
npm/: 5.6.0
Please include all version numbers that might be relevant, e.g. third-party libraries
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
FYI: ng-packagr 1 (and Angular 4 for that matter) is no longer supported.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. This action has been performed automatically by a bot.