简体   繁体   English

Angular Grunt构建在分发构建期间找不到uglifyjs模块

[英]Angular grunt build can't find uglifyjs module during distribution build

When running the test build, everything works find but when I try to build the distribution, I get the following error: 运行测试版本时,一切正常,但是当我尝试构建发行版时,出现以下错误:

Cannot find module '/Users/matt.sich/Documents/angularProjects/firstProject/node_modules/grunt-usemin/lib/config/uglifyjs' Use --force to continue.

I checked that folder and the module is there. 我检查了那个文件夹,模块在那里。 I have it installed in npm. 我已经在npm中安装了它。 I tried removing the npm modules directory and reinstalling with npm install. 我尝试删除npm modules目录,然后使用npm install重新安装。 This didn't solve the issue. 这没有解决问题。

The issue was with the package.json and having ^s in front of the versions. 问题出在package.json,版本前面有^ s。 The ^ updates to new minor versions of the dependencies. ^更新为依赖项的新次要版本。 It's better practice to not use ^s and instead use the actual version you want to use and manually update the versions when needed. 最好不要使用^ s,而是使用要使用的实际版本,并在需要时手动更新版本。 Here's a way to migrate from ^s to version numbers: https://www.npmjs.com/package/npm-check-updates 这是从^ s迁移到版本号的一种方法: https : //www.npmjs.com/package/npm-check-updates

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM