标签: node-modules

heroku 上未安装 node_modules

下面是两个包,我试图用它们将我的项目推送到heroku,控制台说npm和node已安装在服务器上,但是当我克隆项目时,项目中没有node_modules目录。package.json 中的“bower install”表示未找到 Bower。当我删除“bower install”时,推送时不会在服务器上安装任何依赖项,尽管控制台将它们记录为已安装,但当我打开浏览器控制台时,它们不会安装在服务器上。

包.json:

{
  "name": "meal-order",
  "version": "0.0.0",
  "description": "This is an app for ordering meal",
  "main": "gulpfile.js",
  "dependencies": {
    "angular": "^1.5.5",
    .....(other angular -libs)
    "express": "^4.14.0",
    "gulp": "^3.8.8",
    "gulp-connect": "^3.0.9",
    "ionicons": "^3.0.0",
    "protractor": "^3.3.0"
  },
  "devDependencies": {
      "bower": "1.7.7"
  },
  "engines": {
    "node": "^5.11.1",
    "npm": "^3.8.6"
  },
  "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js",
    "postinstall": "bower install"
  },
Run Code Online (Sandbox Code Playgroud)

鲍尔.json:

"dependencies": {
"angular": "^1.5.5",
.....(other angular -libs)
"express": "^4.14.0",
"gulp": …
Run Code Online (Sandbox Code Playgroud)

dependencies heroku npm node-modules bower

3
推荐指数
1
解决办法
3573
查看次数

如何在node.js上引用把手中带有空格的元素?

我有一个对象,其中一些值是包含空格的字符串。像这样的东西:

object = {
 "group of people": [
  {
   (...)
  }
 ],
 "another group of people": [
  {
   (...)
  }
 ]
}
Run Code Online (Sandbox Code Playgroud)

我尝试将它与我的视图(index.hbs)中的车把辅助块一起使用,如下所示:

{{#each group of people}}
 (...)
{{/each}}
Run Code Online (Sandbox Code Playgroud)

但由于“一群人”上的空格,我得到了一个错误(当然)。我尝试过以下案例但没有成功:

{{#each "group of people"}}
{{#each 'group of people'}}
{{#each group%20of%20people}}
{{#each groupofpeople}}
{{#each group of people}}
Run Code Online (Sandbox Code Playgroud)

关于如何让它发挥作用有什么想法吗?

javascript node.js npm handlebars.js node-modules

3
推荐指数
1
解决办法
2426
查看次数

我应该依赖 package.json 还是在我的节点模块上保留版本控制?

最近在做react-native项目。我已经完成了一个旧项目,我想将其克隆到一个新项目中,以便我可以在旧版本之上开发新的东西,但不会影响旧项目本身。

我发现,每次使用npm install相同的 package.json 时,node_modules安装的文件夹可能不一样。这可能是因为我们在某些模块版本前面有前缀^或。~此外,安装的模块也有自己的依赖项,可以自行更新。

所以,就说到了问题所在。我应该使用 package.json 进行版本控制吗?

根据这里:Why do we need to use package.json? , 它说package.json provides a simple way for people to keep track of packages they use in their application.

package.json但是,如果总是自己更新项目而不关心不同模块的兼容性,我如何对我的项目进行版本控制呢?

我想到的唯一解决方案是:我们应该对node_modules进行版本控制。如果是这样的话,package.json 就变得毫无意义了吗?

那么,我想知道对相关项目进行版本控制的行业实践是怎样node_modulespackage.json

version-control node.js node-modules package.json react-native

3
推荐指数
1
解决办法
1276
查看次数

如何从节点包库内部需要根项目目录中的某些内容?

我想创建一个节点包模块,但我很难要求根项目目录中的文件在我创建的节点包模块中使用。

如果我有这样的目录结构

- node_modules
  - library_name
    - lib
      - index.js
    - bin
      - run.sh
-  config.js
Run Code Online (Sandbox Code Playgroud)

如果调用了 run.sh,它将运行 index.js。在index.js中,如何解析根目录,稍后我可以在index.js中要求config.js?

javascript node.js node-modules

3
推荐指数
1
解决办法
1万
查看次数

“HttpIntercept”类型中的属性“intercept”不可分配给基类型“HttpInterceptor”中的同一属性

我正在尝试运行角度应用程序。使用 ng 服务,但出现错误,如下所示:

node_modules/angular-authentication-service/dist/app/classes/http.intercept.d.ts(5,5) 中的错误:错误 TS2416:“HttpIntercept”类型中的属性“intercept”无法分配给基中的同一属性输入“HttpInterceptor”。

Package.json 文件

"dependencies": {
    "@angular/animations": "^7.2.10",
    "@angular/cdk": "^7.3.5",
    "@angular/common": "7.0.1",
    "@angular/compiler": "7.0.1",
    "@angular/core": "7.0.1",
    "@angular/flex-layout": "^7.0.0-beta.24",
    "@angular/forms": "^6.1.10",
    "@angular/http": "^6.1.10",
    "@angular/material": "^6.4.7",
    "@angular/platform-browser": "7.0.1",
    "@angular/platform-browser-dynamic": "^7.2.10",
    "@angular/router": "7.0.1",
    "@firebase/app-types": "^0.3.7",
    "@firebase/auth-types": "^0.3.4",
    "@firebase/database-types": "^0.3.8",
    "@firebase/firestore-types": "^0.7.0",
    "@firebase/messaging-types": "^0.2.8",
    "@firebase/storage-types": "^0.2.8",
    "@ngrx/store": "^5.2.0",
    "angular-alert-module": "^2.0.3",
    "angular-authentication-service": "^1.1.8",
    "angular2-moment": "^1.9.0",
    "angularfire2": "^5.1.2",
    "bootstrap": "^4.3.1",
    "core-js": "^2.6.5",
    "firebase": "^5.9.1",
    "hammerjs": "^2.0.8",
    "jquery": "^3.3.1",
    "moment": "^2.24.0",
    "ng2-toasty": "^4.0.3",
    "ngx-alerts": "^3.4.1",
    "ngx-embed-video": "^0.3.0",
    "pusher-angular": "^1.0.0",
    "pusher-js": "^4.4.0",
    "rxjs": "^6.4.0", …
Run Code Online (Sandbox Code Playgroud)

node-modules angular angular6

3
推荐指数
2
解决办法
5562
查看次数

TypeScript - “调试器;” 在 Angular 中使用 QA 环境时,语句不起作用

我正在开发一个具有各种环境设置的角度应用程序。当我尝试使用设置一些调试点时遇到问题debugger;

我正在使用ng serve -o --webconfiguration==qa编译node_modules运行服务器。

但是,当我使用ng serve -o调试点时,会被击中。

如何设置我的应用程序以在使用 QA 环境时命中调试点

这是我的配置 - Angular CLI Version - 7.3.8 Node Version - 10.15.3 NPM - 6.4.1 TypeScript - 3.1.6

角度.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "Media-Service-Status": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/Media-Service-Status",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [ …
Run Code Online (Sandbox Code Playgroud)

javascript javascript-debugger node-modules typescript angular

3
推荐指数
1
解决办法
7646
查看次数

出现错误:连接 ECONNREFUSED 127.0.0.1:3306

我是 Node.js 的初学者,正在学习有关如何为 Android 设置 Node.js 服务器的教程。当我执行此命令时,nodemon app.js出现此错误

[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
--Server started at port: 8080--
Error: connect ECONNREFUSED 127.0.0.1:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
    --------------------
    at Protocol._enqueue (F:\soi19\android-login-register-system\server\node_modules\mysql\lib\protocol\Protocol.js:144:48)
    at Protocol.handshake (F:\soi19\android-login-register-system\server\node_modules\mysql\lib\protocol\Protocol.js:51:23)
    at Connection.connect (F:\soi19\android-login-register-system\server\node_modules\mysql\lib\Connection.js:119:18)
    at Object.<anonymous> (F:\soi19\android-login-register-system\server\routes.js:8:4)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
Run Code Online (Sandbox Code Playgroud)

我尝试过其他答案,例如更改host: 'localhost'host:'127.0.0.1'以及类似的其他答案,但没有一个有效。任何帮助,将不胜感激。

node.js node-modules node.js-connect

3
推荐指数
1
解决办法
2万
查看次数

从单独的第三方 Node 模块运行 Sequelize 迁移文件?

我正在开发第三方 NODE 模块,该模块处理发送电子邮件并将其存储在数据库中,所以我们称其为邮件模块。为了让某人使用它的功能,将其导入到他的项目中并使用其功能来发送和存储电子邮件就足够了。

这里的问题是,导入邮件模块的人需要手动创建数据库表来存储电子邮件,因为 Sequelize CLI 在单独的模块中看不到迁移脚本。在 mail-module 中有 Sequelize 迁移脚本,但对于开发人员来说,在模块中查找它比将其复制到自己的项目中并作为其项目的一部分运行更麻烦。

有没有办法避免这种手动工作并进行配置,以便当开发人员(邮件模块的用户)运行自己的迁移脚本时,也会执行邮件模块迁移脚本?

orm node.js sequelize.js node-modules sequelize-cli

3
推荐指数
1
解决办法
1674
查看次数

无法更新 Angular CLI

如您所见,我定期安装版本 9。

\n\n
npm install -g @angular/cli\nnpm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142\n/home/user/.npm-global/bin/ng -> /home/user/.npm-global/lib/node_modules/@angular/cli/bin/ng\n\n> @angular/cli@9.1.1 postinstall /home/user/.npm-global/lib/node_modules/@angular/cli\n> node ./bin/postinstall/script.js\n\n+ @angular/cli@9.1.1\nupdated 1 package in 8.412s\n\n\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n\xe2\x94\x82                 npm update check failed                 \xe2\x94\x82\n\xe2\x94\x82           Try running with sudo or get access           \xe2\x94\x82\n\xe2\x94\x82          to the local update config store via           \xe2\x94\x82\n\xe2\x94\x82 sudo chown -R $USER:$(id -gn $USER) /home/user/.config  \xe2\x94\x82\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98\nuser@computer:~$ npm list -g\n/home/user/.npm-global/lib\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\xac @angular/cli@9.1.1\n
Run Code Online (Sandbox Code Playgroud)\n\n

但是当我使用“ng new app-name”创建新应用程序时,我会安装版本 8。当我使用“ng --version”检查版本时,它表示已安装 v8。

\n\n
ng --version    \n\nAngular CLI: 8.0.3\nNode: 12.16.2\nOS: linux x64\nAngular: \n... \n\nPackage                      Version\n------------------------------------------------------\n@angular-devkit/architect …
Run Code Online (Sandbox Code Playgroud)

npm node-modules angular-cli angular

3
推荐指数
1
解决办法
2533
查看次数

Gatsby-无法解析“C:\Users\...\gatsby-starter-hello-world\node_modules\postcss\lib”中的“路径”

我正在尝试将sanitize-html包与@types/sanitize-html打字稿一起使用,但它会导致以下错误-

ERROR in ./node_modules/postcss/lib/input.js 4:30-45
Module not found: Error: Can't resolve 'path' in 'C:\Users\sapin\Desktop\gatsby-starter-hello-world\node_modules\postcss\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a …
Run Code Online (Sandbox Code Playgroud)

path node.js node-modules gatsby

3
推荐指数
1
解决办法
819
查看次数