gpt4 book ai didi

javascript - 无法在 mac 上的 Meanjs 现有项目中找到本地 grunt

转载 作者:行者123 更新时间:2023-12-03 08:56:51 25 4
gpt4 key购买 nike

我想在我的 mac 电脑上运行我从 friend 那里得到的meanjs现有项目,但是当我运行“grunt”命令时,出现以下错误:

grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

搜索谷歌后我使用了下面这两个命令:

sudo npm install grunt --save-dev

npm install

但出现以下错误:

Loading "gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'load-grunt-tasks'
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

[注意:但是 grunt 正在为我本地 Mac 上新创建的meanjs 项目工作,但不适用于我 friend 的这个旧项目]

更新 - 我这里有 package.json 文件:

{
"name": "meanjsapp",
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js",
"version": "0.0.1",
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"scripts": {
"start": "grunt",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
},
"dependencies": {
"apn": "^1.7.4",
"async": "~0.9.0",
"body-parser": "~1.9.0",
"bower": "~1.3.8",
"chalk": "~0.5",
"compression": "~1.2.0",
"connect-flash": "~0.1.1",
"connect-mongo": "~0.4.1",
"consolidate": "~0.10.0",
"cookie-parser": "~1.3.2",
"cron": "^1.0.9",
"express": "~4.10.1",
"express-session": "~1.9.1",
"forever": "~0.11.0",
"glob": "~4.0.5",
"grunt-cli": "~0.1.13",
"helmet": "~0.5.0",
"jsonwebtoken": "^5.0.2",
"jwt-simple": "^0.3.0",
"lodash": "~2.4.1",
"method-override": "~2.3.0",
"mongoose": "~3.8.8",
"morgan": "~1.4.1",
"multer": "^0.1.8",
"nodemailer": "~1.3.0",
"passport": "~0.2.0",
"passport-facebook": "~1.0.2",
"passport-github": "~0.1.5",
"passport-google-oauth": "~0.1.5",
"passport-linkedin": "~0.1.3",
"passport-local": "~1.0.0",
"passport-twitter": "~1.0.2",
"swig": "~1.4.1"
},
"devDependencies": {
"supertest": "~0.14.0",
"should": "~4.1.0",
"grunt-env": "~0.4.1",
"grunt-node-inspector": "~0.1.3",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-csslint": "^0.3.1",
"grunt-ng-annotate": "~0.4.0",
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-cssmin": "~0.10.0",
"grunt-nodemon": "~0.3.0",
"grunt-concurrent": "~1.0.0",
"grunt-mocha-test": "~0.12.1",
"grunt-karma": "~0.9.0",
"load-grunt-tasks": "~1.0.0",
"karma": "~0.12.0",
"karma-jasmine": "~0.2.1",
"karma-coverage": "~0.2.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-phantomjs-launcher": "~0.1.2"
}
}

有人可以帮我吗?

最佳答案

Node.js 项目如果与 npm 一起使用,则必须附带 package.json 文件。package.json ( https://docs.npmjs.com/files/package.json ) 文件包含有关项目的所有信息,甚至是依赖项(使用 --save 添加)。

因此,如果您的 friend 所做的一切正确,您只需运行 npm install 即可安装所有依赖项。如果没有 package.json 文件或者上面没有写入依赖项,则必须手动安装它们。

grunt 有许多模块可以工作,其中一个称为 load-grunt-tasks 所以你应该再次运行 npm install load-grunt-tasks --save-dev 当然,这只是在文件中没有依赖项的情况下。

关于javascript - 无法在 mac 上的 Meanjs 现有项目中找到本地 grunt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32455775/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com