15

Tôi sử dụng Codeship để kiểm tra my project dựa trên số Polymer starter kit v1.1.Cú phápError: Mã thông báo không mong muốn ILLEGAL trên nhận xét với Trình kiểm tra thành phần web

Khi tôi chạy npm test bên trong đường ống thử nghiệm tôi thấy các lỗi sau:

> @ test /home/rof/src/github.com/TFarla/night-live 
> gulp test:local 

/home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/node_modules/lodash/index.js:8404 
/** 
^^^ 

SyntaxError: Unexpected token ILLEGAL 
at exports.runInThisContext (vm.js:53:16) 
at Module._compile (module.js:413:25) 
at Object.Module._extensions..js (module.js:452:10) 
at Module.load (module.js:355:32) 
at Function.Module._load (module.js:310:12) 
at Module.require (module.js:365:17) 
at require (module.js:384:17) 
at Object.<anonymous> (/home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/lib/hooks.js:3:20) 
at Module._compile (module.js:434:26) 
at Object.Module._extensions..js (module.js:452:10) 
npm ERR! Test failed. See above for more details. 

Dưới đây là các lệnh thiết lập:

# By default we use the Node.js version set in your package.json or the latest 
# version from the 0.10 release 
# 
# You can use nvm to install any Node.js (or io.js) version you require. 
nvm install 4.0 
nvm use 4.0 
npm install -g bower 
npm install -g gulp 
npm install && bower install 

Bất cứ ai cũng có một giải pháp?

Chỉnh sửa: Không chắc chắn nếu có liên quan nhưng khi Codeship thực thi npm install, nó xuất ra rất nhiều phụ thuộc chưa được đáp ứng.

npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/node_modules/browser-sync-ui requires [email protected]'0.0.5' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/connect-history-api-fallback, 
npm WARN unmet dependency which is version 1.1.0 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io requires [email protected]'1.0.3' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/node_modules/socket.io/node_modules/debug, 
npm WARN unmet dependency which is version 2.1.0 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-parser requires [email protected]'0.7.4' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/node_modules/socket.io/node_modules/debug, 
npm WARN unmet dependency which is version 2.1.0 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client requires [email protected]'0.7.4' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/browser-sync/node_modules/socket.io/node_modules/debug, 
npm WARN unmet dependency which is version 2.1.0 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/gulp-jshint/node_modules/jshint requires [email protected]'3.7.x' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/gulp-jshint/node_modules/lodash, 
npm WARN unmet dependency which is version 3.10.1 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/bower requires [email protected]'^1.0.0' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/chalk, 
npm WARN unmet dependency which is version 0.5.1 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/bower requires [email protected]'^0.3.0' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/update-notifier, 
npm WARN unmet dependency which is version 0.5.0 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/wd requires [email protected]'~1.0.0' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/async, 
npm WARN unmet dependency which is version 0.9.2 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/wd requires [email protected]'~3.9.3' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/lodash, 
npm WARN unmet dependency which is version 3.10.1 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/socket.io/node_modules/socket.io-parser requires [email protected]'0.7.4' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/socket.io/node_modules/debug, 
npm WARN unmet dependency which is version 2.1.0 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client requires [email protected]'1.0.4' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/socket.io/node_modules/socket.io-client/node_modules/debug, 
npm WARN unmet dependency which is version 0.7.4 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client requires [email protected]'0.0.4' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/socket.io/node_modules/socket.io-client/node_modules/parseuri, 
npm WARN unmet dependency which is version 0.0.2 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/wct-sauce/node_modules/request/node_modules/har-validator requires [email protected]'^1.0.0' but will load 
npm WARN unmet dependency /home/rof/src/github.com/TFarla/night-live/node_modules/web-component-tester/node_modules/chalk, 
npm WARN unmet dependency which is version 0.5.1 
+0

Hãy thử chạy nó trong một container Docker và xem nếu bạn có thể tạo lại vấn đề đó: 'docker run -it -v = $ PWD/night-live:/usr/src/app -w =/usr/src/app --rm node: 4.0 bash' –

+0

Bạn có đang chuyển mã của bạn bằng babel không? Điều gì về nguồn lực của bạn? Có thể chúng bị hỏng vì lý do nào đó và đó là lý do bạn nhận được nhận xét là vị trí cho lỗi –

+1

'Cú pháp: Lỗi không mong muốn ILLEGAL' là lỗi mà bạn nhận được khi bạn cố gắng yêu cầu tệp JavaScript không đúng định dạng. ví dụ: lỗi cú pháp giống như bất kỳ loại nào, như dấu ngoặc không cân bằng hoặc bất kỳ thứ gì. – arboreal84

Trả lời

0

Sau khi cài đặt phụ thuộc, bạn đã đi vào thư mục mô-đun nút và thay đổi bất kỳ tệp lodash nào?

  1. Dưới đây là một số điều bạn có thể thử.

  2. Trong thư viện dự án của bạn, hãy rm -r node-modules. Thao tác này sẽ xóa thư mục phụ thuộc của nút.

  3. Đi tới package.json của bạn và kiểm tra xem phụ thuộc có bị phản đối hay không; Kiểm tra xem họ có phiên bản mới hơn có sẵn trên npm hay không. Nếu có, hãy cập nhật package.json cho phù hợp. (Phiên bản mới nhất cho trình duyệt đồng bộ hóa là 2.18.13)

  4. List item

  5. Do npm install
  6. Do bower install
Các vấn đề liên quan